Problem with using data2

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Problem with using data2

Postby evdl » 18 Feb 2013

I use a 1 minutes chart of the DAX as data1 and in the same chart also the dax on 1 day resolutions as data2.

For both resolutions I have the settings on 365 days. But the data2 is displaying much more data (see attached pictures). The 1min chart starts at 20 feb 2012 till current date. The daily chart goes back to 13 sept 2011 to current date, although also the daily chart is set to 365 days. This is not ok I think?

The second problem I am having is to get the right values from the data2. In my strategy I use the following code to get the MACD values from data2.

Code: Select all

Close_data2 = close of data2;

If date <> date[1] then begin
MyMACD_day = MACD(Close_data2, MA_Fast_length, MA_Slow_length) of data2; // this is the MACD line
MyMACD_Avg_day = XAverage(MACD(Close_data2, MA_Fast_length, MA_Slow_length), MACD_Length)of data2; // This is MACD average line.
MyMACD_Diff_day = (MyMACD_day - MyMACD_Avg_day); // This is the MACDDiff line.
To compare the values, I also have set up a seperate chart with the daily resolution of the DAX with the prebuilt MACD indicator on it.

The values of the data2 on the combined chart of about the first 4 months of the total of 12 months are different then the MACD values that are on the seperate daily chart. After these 4 months the values are the same (minor round differences). So the code I am using is calculating the right values except for about the first 4 months. What can be the problem with these different values.

Can it have something to do with the daily data2 that has not the same starting date (although the settings are for the same period). Or is there a problem/bug with data2. Or do I have to adjust my coding?

any help appreciated.
Attachments
Chart dax 365 days.png
(152.61 KiB) Downloaded 351 times
Settings instruments.png
(18.61 KiB) Downloaded 336 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Problem with using data2

Postby Henry MultiСharts » 20 Feb 2013

Hello evdl,

1) Please change you "365 days back" request to "From-To" data request. You should get minute data for a year with it.
2) Should be resolved once point 1 is resolved.
The code can be adjusted like that:

Code: Select all

var: MyMACD_day(0, data2), MyMACD_Avg_day(0, data2), MyMACD_Diff_day(0, data2),

MyMACD_day = MACD(Close, MA_Fast_length, MA_Slow_length) of data2; // this is the MACD line
MyMACD_Avg_day = XAverage(MACD(Close, MA_Fast_length, MA_Slow_length) of data2, MACD_Length) of data2; // This is MACD average line.
MyMACD_Diff_day = (MyMACD_day - MyMACD_Avg_day);

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Problem with using data2

Postby evdl » 21 Feb 2013

Thanks I will try this.


Return to “MultiCharts”