How to calculate bar distance beyond timeseries array range?

 

Hi,


I have trendline on D1 chart with time1=2009.12.03 and time2=2010.04.15. This gives 1598 bars between time1 and time2.

For M1 chart for the same symbol I have history only to 04.10.2010, so in this compression time1 is outside the timeseries array.


When I find the time2 point on M1 chart and try to move it with mouse, then MT4 shows that a distance between time2 and time1 is 131324.

Is there any way to calculate this distance from MQL?


Thanks,

Lukasz
 
zork:

Hi,


I have trendline on D1 chart with time1=2009.12.03 and time2=2010.04.15. This gives 1598 bars between time1 and time2.

For M1 chart for the same symbol I have history only to 04.10.2010, so in this compression time1 is outside the timeseries array.


When I find the time2 point on M1 chart and try to move it with mouse, then MT4 shows that a distance between time2 and time1 is 131324.

Is there any way to calculate this distance from MQL?


Thanks,

Lukasz

distance in bars = (time2-time1)/(60*Period());

 
robofx.org:

>> distance in bars = (time2-time1)/(60*Period());

This is true only if trade on given symbol is done continuously and there are no holidays, weekdays or other non-trading hours. My example was for EURUSD, which has 24*5*60 minutes of trading per week. There were the Christmas holidays between 03 December and 04 April. Even counting those holidays and 5-day trading week I don't get 131324 minutes in this period.

I don't think that MT4 has constantly updated database of holidays for every symbol. I can think only of two ways of calculating this:

a) MT4 approximates this somehow using data from history

b) MT4 request this data from server, which would have to store much more data.

Anyone has more details how it is done?

Regards,

Łukasz

 

Hi, there is some strategies where you have to wait midnight to set orders in a daily chart.
Is there a script or oder system to change the daily candles open time?
Thank you and good trade.