MQL4 & MQL5 EA code needed for strategy backtesting "Model: Open prices only"

 

The strategy tester allows for "Model: Open prices only" in MT4/MT5, however its baked into the tester.  I need this added to my EA's such that after my rules are met, then each buy/sell order is opened at/with the next new candle open, such that with each order is submitted for execution starting exactly with the open of the next new candle (for all current timeframes, etc.) automatically.  Would anyone know how to code this in MQL4 &/or MQL5, and kindly share or message me?

 
Richard Downey Jr:

The strategy tester allows for "Model: Open prices only" in MT4/MT5, however its baked into the tester.  I need this added to my EA's such that after my rules are met, then each buy/sell order is opened at/with the next new candle open, such that with each order is submitted for execution starting exactly with the open of the next new candle (for all current timeframes, etc.) automatically.  Would anyone know how to code this in MQL4 &/or MQL5, and kindly share or message me?

Example: at the moment of the birth of a new bar, a position of 1.0 lot is opened

How to start with MQL5
How to start with MQL5
  • 2020.09.17
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
Richard Downey Jr: then each buy/sell order is opened at/with the next new candle open,

So filter your ticks by new bar — what's the problem?

For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
          New candle - MQL4 programming forum #3 2014.04.04

I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
          Running EA once at the start of each bar - MQL4 programming forum 2011.05.06

Reason: