Is the backtest information correct?

 
Is the backtest information correct?

I programmed the Expert, and during the back-test, it showed me great results,<Deleted>:

The important question: Can the results of the back-test be relied

upon, and to what extent they can be consistent with reality? Please help me in this matter. Thanks


 

Your question do not have a single reply, basically it depends.

If your EA uses to check Ask/Bid prices or indicators values from current bar or rates of current bar, the backtest as 'control point' or 'hloc' cannot works correctly. (Please note that in this situations fall also all breakeven and trailing function if they use Ask/Bid price for making calculations).

If your EA only trades using rates from last closed candle and indicators from minimum last closed bar you will have no problem and your test is reliable.


In your case, I'm supposing you are backtesting the Daily timeframe using 'Control points' mode.

I see EA moving pending trades several time inside a single day: it means you are trusting 'fake' control points automatically generated for making EA decisions.

I have no doubts that your backtest is so far from the reality :-)

 
hussein hameed:
Is the backtest information correct?

I programmed the Expert, and during the back-test, it showed me great results, as shown in the pictures below:

The important question: Can the results of the back-test be relied

upon, and to what extent they can be consistent with reality? Please help me in this matter. Thanks



Testing period is one of most important thing, It seems like you tested it for short period of time.

 
hussein hameed:
Is the backtest information correct?

I programmed the Expert, and during the back-test, it showed me great results,<Deleted>:

The important question: Can the results of the back-test be relied

upon, and to what extent they can be consistent with reality? Please help me in this matter. Thanks


I use backtests to analyze the potential of the EA that I am analyzing, just that. If the backtest is good, I can conclude that the EA manages to make a profit under the analyzed market conditions BUT, I am also aware that the past behavior of the market is not a guarantee of similar behavior in the future. I can only conclude that an EA with a good backtest can give more confidence in the future than an EA with a bad backtest.

 
hussein hameed: Is the backtest information correct? I programmed the Expert, and during the back-test, it showed me great results,<Deleted>: The important question: Can the results of the back-test be relied

upon, and to what extent they can be consistent with reality? Please help me in this matter. Thanks

Unfortunately, any EA relying on pending orders or broker stops (S/L & T/P) will seriously be misrepresented in the Strategy Tester and on the most part it will be more favourable than on live trading, especially when running the test with tick values.

The reason is as follows — the tester will take pending orders and the stops at the exact prices they are set to be triggered instead of the real quote value of the test market at the time. Even if in the tester the quote price would cause slippage, it still marks them as been taken at the trigger price.

For my own EAs, I never use pending orders and implement virtual stops to get a more realist back test, and the difference is always very noticeable. Here is a reference to another thread in which a user notice the same problem in his back-testing and my answer to the problem:

Forum on trading, automated trading systems and testing trading strategies

Calculate the stop loss at the close of the candle

Edinson Perez, 2022.03.26 00:32



When I open a sell trade I set the stoploss at +5 USD, but the price rises sharply and breaks the stoploss at +15 USD in one move, and the tester calculates that blow at +5 USD in the final balance and does not at +15 USD which is the close of the candle, do you understand me? How to calculate the stoploss at the close of that candle?


The tester gives me wrong results for this reason, example: the final balance should be $10020 and not $10125.


Forum on trading, automated trading systems and testing trading strategies

Calculate the stop loss at the close of the candle

Fernando Carreiro, 2022.03.26 01:00

Ok, now I understand the issue, but unfortunately all we have discussed so far has nothing to do with it nor will it solve the problem.

The issue is that the Strategy Tester will take the S/L and T/P at the exact price you set it instead of the real price slippage. The same also happens for the opening price of pending orders.

This is a real problem which MetaQuotes has never corrected and it has been like that even in MT4 (and it also makes back tests of Market products look very nice in the Strategy Tester, but bad in live trading).

The only solution I have come up with, is to implement virtual stops that are handled within the code (instead of the broker/tester side), that simulates the stops being hit and closes the positions when the target stops are reached.

In my own EAs I do the following:

  • I add an offset (a fixed amount of points, a very large size) to all my stops when the order is placed. For example, I add an extra 10000 points to the real stop price.
  • Then in the code, I monitor the trades and read the current stops (from open positions) and subtract the offset from their distances (the 10000 points) to get the real stop prices.
  • I then check if the Bid (for buys) or Ask (for sells) has reached those real stops.
  • If they are indeed hit, I then close the positions in the code and in this way, the positions are closed at the real prices with slippage.

When the EA is trading live, all I do is set the virtual stop offset to 0, instead of 10000 for the Strategy Tester.

The reason I use this offset is so that I still have the stops information stored with the order and position and I don't need to keep an internal cache of the data of the real stops. It is all stored within the normal trading records but just offset in value.

The value I choose, for example 10000, is so that the stops don't get accidentality triggered (in the tester system) by a very big spike in spread or slippage and also because it is a "nice" number and easy to calculate visually when reading the test reports.

I hope you will be able to understand all this process. However, for a beginner it may be difficult to implement, as it requires a higher level of coding skills.

Reason: