Array of ticks in the current bar
burrocampeador: My EA lasts a lot of time, so several ticks can appear while my EA is running.
| Any ticks that come in while the EA is running are lost. |
you would have to make your own array and call RefreshRates() periodically in your long time taking code and each time Bid has changed then it is a new tick
SDC:
you would have to make your own array and call RefreshRates() periodically in your long time taking code and each time Bid has changed then it is a new tick
Would not the ea becomes busy and ignoring others while it is doing its calculations?
Hmm.. I can see now.
Thank you very much for your responses!! Then, the strategy is to program an EA that is a loop and never ends. Inside the loop, the EA saves continuously every tick in an array and sometimes makes the calculations with the mentioned array. Is that correct?
burrocampeador: Then, the strategy is to program an EA that is a loop and never ends.
| The better strategy is to determine when you need to do something (price reaches a trigger) or when the something is no longer valid (new bar), and just return from OnTick() when there is nothing to do. When OnTick() is called you know it's a new tick. If you loop, you are sampling ticks at your loop frequency, and that may or may not be all ticks. |
Is there any way to know the list of all ticks in the current bar? My EA lasts a lot of time, so several ticks can appear while my EA is running. Therefore, I need know the list of appeared ticks in the current bar. Is it possible in MQL4?
Thank you very much!