# Charts 5 day moving average, 10 day moving average

1. ## Charts 5 day moving average, 10 day moving average

hello everybody,

i need to do an assignment but i have no real clue how to solve it. i would really appreciate if you could give me a hand with this.

Here are the instructions for completing the exercise:
-save the attached Excel file (exercise.xls) to your PC and open this file
on the 'data' sheet you'll find 2.5 months of stock index data for Nasdaq, CAC and FTSE the requirement is to create separate charts for each index showing the index movement against date, together with 5-day and 10-day moving averages

Suggested method:
insert a new code module for your code
use the 'calcs' sheet to do calculations (in code) of index, 5 and 10 day moving averages; try getting this right just for one index first before writing a loop to run over all indices

5-day average is over the last 5 days; 10 day average is over the last 10 days - therefore some cells are blank (see attachment)

important techniques:
-to point to a spreadsheet cell: shtData.Cells(5, 1)
-to point to a spreadsheet range: shtData.Range(shtData.Cells(1, 1), shtData.Cells(20, 4))
-add a command button to the data sheet from which the code is triggered
-delete existing charts before redrawing (see code from previous exercise)
-your code should not contain any hard-coded index names
-your code should be flexible enough to deal with adding more column data (indices e.g. DAX, DJI) or more rows of dates - if such data was added (in other words there should be no hard-coding of last row or last column values)
-follow best practices in coding (e.g. comments, indentation, breaking code into separate routines, etc.)

i would really appreciate your help. thanks so much in advance. i guess for some of you this might be a piece of cake.

cheers,

claudio

2. Mona Lisa, Mona Lisa,

We advise on homework rather than do it. So, what is your code so far?

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1