Download MetaTrader 5
To add comments, please log in or register
Publish your article and get a reward!
burrocampeador
75
burrocampeador 2014.06.08 09:54 

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!

whroeder1
13602
whroeder1 2014.06.08 10:08  
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.
Ian Venner
2583
Ian Venner 2014.06.09 04:47  

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

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.06.09 05:16  
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?
Ian Venner
2583
Ian Venner 2014.06.09 05:32  
yes unless you interupt the calculations to check for new ticks
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.06.09 06:01  
Hmm.. I can see now.
burrocampeador
75
burrocampeador 2014.06.13 11:25  
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?
whroeder1
13602
whroeder1 2014.06.13 11:37  
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.
/
To add comments, please log in or register