Forum

Where to define CopyRates ? In OnTick() or OnInit()

I have been trying to make an EA, I used CopyRates in the OnInit function. And I noticed the values weren't refreshing as new tick data came or the new candle formed. So is it advised to place it in OnInit fuction? Thanks for help

How can I find the previous moving average crossover price x candle before in mql5?

I can get and identify current crossover by using 1 and 2 buffer of the two MA indicators. But i want to get the previous crossover and the corresponding X candle. Should i run the crossover check on every newBar and re assign a value on every tick ? please pardon my english