MQL4 offset returning different time
MQL4 offset returning different time
Loading saved threads...
MIchal Skoda · External communityPost link
External question — Stack Overflow Stack Exchange
Author: MIchal Skoda
Original post: https://stackoverflow.com/questions/76821085
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I have folowing code in MQL4:
#property copyright "Copyright 2023, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
MqlRates bar_main_pair[];
MqlRates bar_H1[];
string main_pair = "EURUSD";
int HistoryLength = 1000;
int OnInit()
{
return(INIT_SUCCEEDED);
}
void OnTick()
{
ArraySetAsSeries(bar_H1, true);
CopyRates(_Symbol, PERIOD_H1, 0, HistoryLength + 100, bar_H1);
ArraySetAsSeries(bar_main_pair, true);
CopyRates(main_pair, PERIOD_H1, 0, HistoryLength + 100, bar_main_pair);
Print(bar_H1[82].time, " ", bar_main_pair[82].time);
}
but on FTMO it is returning different times for EURUSD and GBPUSD. _Symbol is GBPUSD. Can someone please advise why?
I actually extended the Print in the code:
and result is strange ...
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: PaulB
Original post: https://stackoverflow.com/a/76821230
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
It looks like you are running this through the strategy tested. When in tester mode, if you are refencing a different chart the the current bar (Bar[0]) is not available to read, this will therefore be producing a 1 hour difference in your code. Changing your start bar to 1 should solve the problem.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: PaulB Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/76821230 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. It looks like you are running this through the strategy tested. When in tester mode, if you are refencing a different chart the the current bar (Bar[0]) is not available to read, this will therefore be producing a 1 hour difference in your code. Changing your start bar to 1 should solve the problem.
Checking account access…