saurabhB: In MT5 strategy tester, we get option to backtest on "Open price" model. But in reality, EA's take trade in every tick value instread of bar's open price. How can I make my EA take trade on "Open price" Instead on "every tick"?
Detect when there is a new bar and only open (or close) trades on that tick.
Forum on trading, automated trading systems and testing trading strategies
Fernando Carreiro, 2021.04.30 08:27
What do you mean by "candles shift"? Do you mean when the current bar closes and a new one opens? Is that it?
If that is the case, then there are several examples here in the forum for detecting a new bar. Basically you just monitor the time of the last or current bar and detect when it changes. You can do the same for the other time-frames as well!
// Check for New Bar static datetime dtBarCurrent = WRONG_VALUE; datetime dtBarPrevious = dtBarCurrent; dtBarCurrent = (datetime) SeriesInfoInteger( _Symbol, _Period, SERIES_LASTBAR_DATE ); bool boolNewBarFlag = ( dtBarCurrent != dtBarPrevious ); if( boolNewBarFlag ) { Print( "... do something ..." ); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello Guys,
In MT5 strategy tester, we get option to backtest on "Open price" model. But in reality, EA's take trade in every tick value instread of bar's open price.
How can I make my EA take trade on "Open price" Instead on "every tick"?
I have attached my ea here.
Thank you in advance.
Regards,
Saurabh