The OnTick() Event Handler gets called on every Tick (just as the name says) and NOT on every M5 bar, just because it is on a M5 Chart.
For example, if given that there is an average VOLUME of 300 ticks per M5 bar (and that there are 12 M5 bars per hour), then that would give 24hr x 12 x 300 ticks = 86400 ticks per day.
Therefore, if you increment the size of your array on every tick, obviously it will have 86400 elements within a period of 24 hours and will continue to grow, and is in no way linked to the number of Bars on the Chart.
The OnTick() Event Handler gets called on every Tick (just as the name says) and NOT on every M5 bar, just because it is on a M5 Chart.
For example, if given that there is an average VOLUME of 300 ticks per M5 bar (and that there are 12 M5 bars per hour), then that would give 24hr x 12 x 300 ticks = 86400 ticks per day.
Therefore, if you increment the size of your array on every tick, obviously it will have 86400 elements within a period of 24 hours and will continue to grow, and is in no way linked to the number of Bars on the Chart.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Why does an empty dynamic array, on a 1 day EA with a 5m timeframe produce > 80k element with this code?
Is it always linked to the amount of bars on the chart? Because I don't want that. I just need the Series functionality to catch the latest 3 zigzag values.
This produces:
2016.08.18 22:52:49.590 2016.08.03 23:56 NQ 123 Expert EURUSD,M5: Array Size: 82841
2016.08.18 22:52:49.590 2016.08.03 23:56 NQ 123 Expert EURUSD,M5: Array Size: 82840
2016.08.18 22:52:49.590 2016.08.03 23:55 NQ 123 Expert EURUSD,M5: Array Size: 82840
2016.08.18 22:52:49.589 2016.08.03 23:55 NQ 123 Expert EURUSD,M5: Array Size: 82839
2016.08.18 22:52:49.463 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82043
2016.08.18 22:52:49.462 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82042
2016.08.18 22:52:49.462 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82042
2016.08.18 22:52:49.462 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82041
2016.08.18 22:52:49.461 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82041
2016.08.18 22:52:49.461 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82040
2016.08.18 22:52:49.461 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82040
2016.08.18 22:52:49.461 2016.08.03 23:29 NQ 123 Expert EURUSD,M5: Array Size: 82039
Yes, it really starts at 82039..