For most accuracy use every tick based on real ticks. Different modes use different means to check TP/SL levels. Read more https://www.mql5.com/en/articles/2612
But even in best case, the tester can give you *free* money with TP/SL/LIMIT orders by means of unrealistic high positive slippage.
Dear Enrique Dangeroux, this was exactly the problem.
I switched to "Every tick based on real ticks" and the two TS produced the same results.
So when functions working on real time ticks are used (e.g. buystop) it is fundamental to use such modes.
Your help has been precious! Thank you!!
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 everyone!
I am experiencing something weird while backtesting my trading system.
I made two versions of the same TS:
1st VERSION:
This is how I open short positions (I skipped useless code):
I put "NULL" on take-profit field because I use the following code to close positions in take-profit:
Obvoulsly I used analogue code for long positions but it is not relevant.
2nd VERSION:
This is how I open short positions:
Here I put "TP_price" in the the specific field of SellStop command to close positions in take-profit.
So there is no need of PositionClose code here.
The problem is that I get different values for TP_price using these two versions, and I don't understand why.
As an example, let's focus on a specific deal on EURUSD where we have IN_price=1.31430 and SL_price=1.31331.
Here following the exit price at which the deal is closed by the trading system using different values of the variable "multiplier":
All these deals are in profit.
The fields without asterisk mean that the deal is opened and closed in the same candle.
The fields with the asterisk mean that the deal is closed in the candle just after the opening candle.
In the 2nd version the exit prices correspond to the TP_prices expected, using the formula TP_price = IN_price-multiplier*(SL_price-IN_price)
On the countrary, in the 1st version they don't correspond! Why?
Besides, in the 1st version the exit price doesn't change if the deal is opened and closed in the same candle (it remains 1.31250). Why?
In conclusion, the 1st version seems not working as expected.
Probably I'm missing something... Does anyone know what?
Thank you in advance for your help!