MT4 Backtesting Problem, Buys and Sells not within bar range

 

I'm trying to backtest an ea for a single indicator on the 15 minute time frame. I can run the backtest with 90% modeling quality, but the results are inaccurate. When I open the chart to view the trades made, there are many buys and sells that were triggered by a price not within the range of the bar. I cannot figure out how to fix this. I downloaded the historical data from MT4 starting from the 1-minute to get accurate prices.

It is a regular occurrence on every backtest.

 
jsinger0422: I'm trying to backtest an ea for a single indicator on the 15 minute time frame. I can run the backtest with 90% modeling quality, but the results are inaccurate. When I open the chart to view the trades made, there are many buys and sells that were triggered by a price not within the range of the bar. I cannot figure out how to fix this. I downloaded the historical data from MT4 starting from the 1-minute to get accurate prices. It is a regular occurrence on every backtest.

It is called "spread"! There is a Ask price and a Bid price. Charts only shows the bars/candles based on Bid prices.

  • A "buy" position opens at the Ask price and closes at the Bid price.
  • A "sell" position opens at the Bid price and closes at the Ask price.
 
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
  • book.mql4.com
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
 
Fernando Carreiro #:

It is called "spread"! There is a Ask price and a Bid price. Charts only shows the bars/candles based on Bid prices.

  • A "buy" position opens at the Ask price and closes at the Bid price.
  • A "sell" position opens at the Bid price and closes at the Ask price.
Thanks fernando. That explains it
 
jsinger0422 #: Thanks fernando. That explains it
You are welcome!