Discrepancy in Strategy Tester Results for Similar Strategies in MQL4 and MQL5

 

I have encountered an interesting issue while testing two similar trading strategies in both MQL4 and MQL5 languages. The strategies are written correctly, yet they produce different results when backtested using the Strategy Tester. I'm hoping someone can shed some light on this discrepancy and help me understand the possible reasons behind it.

Some key details about the strategies and the testing environment:

  1. I have implemented the same trading logic and conditions in both MQL4 and MQL5 languages.
  2. I'm using the same historical price data for backtesting in the Strategy Tester for both versions.
  3. I have ensured that there are no errors or warnings during compilation of both codes.
  4. The strategies aim to use standard indicators and functions available in both MQL4 and MQL5.

Despite these efforts to keep both strategies consistent, the backtest results show noticeable differences in performance metrics such as profit, drawdown, and total trades executed.

Could someone please provide some insights into the possible reasons for such discrepancies between MQL4 and MQL5 backtest results? Is there anything specific to be mindful of when migrating a strategy from MQL4 to MQL5 that might influence the backtest outcomes?

I greatly appreciate any guidance or suggestions that can help me reconcile the differences and ensure the strategies behave as expected in both MQL4 and MQL5 environments.



Files:
mt4.PNG  32 kb
mt5.PNG  30 kb
 

No offense but we need to accept what you said as is ?

The strategies are written correctly

How do you know that ? "Errare humanum est".

I'm using the same historical price data for backtesting in the Strategy Tester for both versions.

How ? Did you check the tester is really using the same data (OHLC and ticks) ?

MT4 results can only be compared to MT5 using real ticks. You screenshots doesn't show you are using real ticks (90% quality data with 29 mismatch errors).

The strategies aim to use standard indicators and functions available in both MQL4 and MQL5.

Did you check that the indicators provide the same data ?

This is a technical forum, after providing answers to the above, you will need to provide precise technical details to get further useful help. (Code, tester parameters, logs, etc...)

 
If you think you did all correctly, start a visual backtest of only few days, in which some trades are took.

Analyze what happens, compare results and you will understand where you did a mistake into the code, or what you didn't considered that works differently between MT4 and MT5.
Reason: