You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
So basically MT4 needs some history first before it can properly loads the indicator.
Yes it appears so, I think the terminal should check history first history first, then reload the indicator.
Funny enough I also had a copy of the old zigzag indicator on the same chart, the old version that used int start() and the old series arries arrays.
The zigzag continued to run without a problem through all the pair changes that threw the test indicator off the chart.
The test indicator was run in OnCalculate() with #property strict.
resetting static
Oh i see, I thought we were talking about initializing specifically for first tick, next new bar reasons. static datetime last_time = Time[0];
static datetime last_time = 0 will not trigger mid bar on pair changing because the current bar time has already been executed on the previous pair. The static datetime is not re-initialized when changing pairs so it still retains the current bar time.
To make it always execute mid bar on pair change and/or timeframe change we could set the static back to zero in OnDeinit() reason 3 or retain the reason code for other alternatives in the new chart.
2014.05.16 12:35:03.657 Test Forum EA stuff USDJPY,H1: Alert: last time = 2014.05.16 20:00:00
2014.05.16 12:35:03.467 Test Forum EA stuff USDJPY,H1: Alert: last time = 2014.05.16 20:00:00
2014.05.16 12:35:03.142 Test Forum EA stuff USDJPY,H1: Alert: last time = 2014.05.16 20:00:00 // ---- static datetime retains previous pair's bar time
2014.05.16 12:34:59.179 Test Forum EA stuff USDJPY,H1: initialized
2014.05.16 12:34:58.446 Test Forum EA stuff XAGUSD,H1: uninit reason 3 // ------------------------------- pair changed
2014.05.16 12:34:56.115 Test Forum EA stuff XAGUSD,H1: Alert: last time = 2014.05.16 20:00:00
2014.05.16 12:34:50.740 Test Forum EA stuff XAGUSD,H1: Alert: last time = 2014.05.16 20:00:00
2014.05.16 12:34:42.075 Test Forum EA stuff XAGUSD,H1: Alert: new bar
2014.05.16 12:34:42.075 Test Forum EA stuff XAGUSD,H1: Alert: last time = 1970.01.01 00:00:00 // --- static datetime initialized to zero = 1970 date
2014.05.16 12:34:19.518 Test Forum EA stuff XAGUSD,H1: initialized
2014.05.16 12:34:15.103 Expert Test Forum EA stuff XAGUSD,H1: loaded successfully