I have a question. I have started a trading strategy and this is the code:
1
2
3
4
5
6
7
8
9
10
11
12
// Conditions to enter long positions
IFclose>openthen
BUY1CONTRACTATMARKET
ENDIF
// Conditions to enter short positions
Ifclose<openthen
SELLSHORT1CONTRACTATMARKET
ENDIF
// Stops and targets
SET STOPpTRAILING5
I have started the strategy with broker IG. Now, the strange thing is that there is a big difference between the results of broker IG and backtest prorealtime. Can somebody help me out why there is such a big difference? Attached you will find the results of broker IG and prorealtime.
Seems that you don’t test your strategy on the same timeframe? Trades are closed on round hour in the first screenshot and that’s not the case in the second one.
I think you are talking about trading real-time in demo? isn’t it?
If yes, backtest are more efficient because it only deals with condition once per bar, so it doesn’t know at what time your trailing stop occurred, and that’s of course not the case in real-time where stoploss are well executed at correct prices.
Hi Nicolas, just wanted to clarify to your response above are you saying that in backtest the trailing stop would be calculated at end of each bar but auto trading mode it would move in real time as the underlying price moves?
That was indeed the case 4 years ago, before PRT add the tick-by-tick backtest engine. The “0 bar issue” is something we don’t talk anymore since years. Always make your backtests with the tick mode option checked.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.