![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Never said I tested it. :)
False. On a disconnect/reconnect, only Bars changes, the old IndicatorCounted() doesn't, so it only processes the new bars. Only on older history download would IndicatorCounted return zero. Same for the new prev_calculated: "if since the last call of OnCalculate() price data has changed (a deeper history downloaded or history blanks filled), the value of the input parameter prev_calculated will be set to zero by the terminal."
No, my previous post was correct I have previously tested for this undocumented behaviour, because it caused me some issues.
Bars is never reset to zero. IndicatorCounted() resets to zero but not immediately on reconnect, it will return its previous value for two ticks, then it will return its previous value+1 for two more ticks, then it will reset to zero ... I didn't entirely figure out the reasons for these behaviours, you can see from the logs what it does:
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- Several more ticks after this one will continue arriving in rapid succession
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- Notice these ticks have been arriving in rapid succession (probably artificial)
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250035 //---- IndicatorCounted now begins including filled in bars.
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 0 //------------ On the 4th tick after reconnect, IndicatorCounted resets to zero, entire chart redrawn.
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250028 //---- 3rd tick IndicatorCounted() returns the old value+1
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250028 //---- 2nd tick: IndicatorCounted() returns the old value+1
2014.02.20 15:32:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- 1st tick: IndicatorCounted() returns old value again.
2014.02.20 15:32:15 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- Internet Resonnected several bars later. IndicatorCounted returns old value (as before disconnect).
2014.02.20 15:23:42 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027 //---- Internet Disconnected
2014.02.20 15:23:39 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250027
2014.02.20 15:23:34 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026
2014.02.20 15:23:28 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026
2014.02.20 15:23:21 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 250026 //---- notice ticks arriving several seconds apart
2014.02.20 15:23:16 IndicatorCounted EURUSD,M1: Alert: IndicatorCounted == 0 //------------IndicatorCounted() initial value, entire chart drawn in loop.
2014.02.20 15:23:14 IndicatorCounted EURUSD,M1: initialized
I was planning to lol ... I'll start a new thread I might copy that IndicatorCounted test to it too.
I didnt start a new thread because it is mentioned in the docs that prev_calculated also resets to zero when chart history is added, it does very similar to IndicatorCounted().
You can see rates_previous operates almost identical to IndicatorCounted()
prev_counted == IndicatorCounted() - 1 except on inital zero and history added, then prev_calculated == IndicatorCounted().
Internet disconnect causes identical behaviour.
2014.02.25 16:22:15.997 Test indicator loop EURUSD,M1: uninit reason 1
2014.02.25 16:22:11.545 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:10.418 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:09.936 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:08.744 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:07.037 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251247 prev_calculated = 251248
2014.02.25 16:22:00.103 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.051 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.049 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:54.002 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.965 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.923 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251246 prev_calculated = 251247
2014.02.25 16:21:53.882 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 0 prev_calculated = 0 //------------------- Reset to zero
2014.02.25 16:21:53.791 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:21:51.498 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236 //---- Internet Reconnected
2014.02.25 16:10:00.709 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236 //---- Internet Disconnected
2014.02.25 16:10:00.255 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:59.788 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:59.337 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251235 prev_calculated = 251236
2014.02.25 16:09:58.924 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:40.369 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:31.285 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 251234 prev_calculated = 251235
2014.02.25 16:09:30.960 Test indicator loop EURUSD,M1: Alert: IndicatorCounted = 0 prev_calculated = 0 //------------------ Initial zero
2014.02.25 16:09:30.960 Test indicator loop EURUSD,M1: initialized