How to prevent from opening new order in same candle
- only one order in one candle.
- How to prevent my expert to open new order if other order was already closed on the same candle
- Buy only at a close price
- Remember and check the candle open time.
- Act on a change of signal.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum
1、only one order in one candle.: set a global variable to record the time of every candle, open orders only when the value of the vairable changes.
2、Buy only at a close price:buying at a close price would be the same with buying at the next open price, the method mentioned above could solve this as well.
3、How to prevent my expert to open new order if other order was already closed on the same candle:
you need to build a function that returns the close time of the last closed order. then check if TimeCurrent() > last_close_time + periodseconds();
- 2010.01.30
- www.mql5.com