Delay funtcion needed
-
Hi guys.
When a trade closes, there needs to be a delay before another trade can be opened. For example, on an hourly chart, I don't want the 2nd trade to open in the same candle in which the first trade closed. I need one or two hours delay before the EA can check for the conditions and open another trade.
The EA needs to open a trade when a new candle opens. So, when a trade closes in the middle of a candlestick, and the conditions are met for a new trade, the new trade will be opened in the middle of the candle, which is incorrect. So, in order to avoid this, I need to program some sort of a delay.Can anyone give me some advice, please? I tried the 'delay' function but it creates a critical error when the EA runs.
-
Did you try "Skip Ticks" block? That may be of some help
-
I just tried the "Skip Ticks" block. It messes up a few things because the EA analyses the previous 3 candlesticks before executing a trade. But thanks for the tip, I'm sure I will find a way to figure it out.
-
I would ask for the age of the last trade, something like that:

This will also work if you restart MetaTrader, because no temporary variables are used.
Also this block "Check profit (period of time)" can be used I think. The idea is that you can define certain period of time and ask for the profit... to be 0 I guess.