indicator compare price real vs backtest
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › indicator compare price real vs backtest
just a test to compare the visual differences real- vs backtest price.
Even in this case below, when buying higher then in the backtest, I want to maintain its exit-scenario i.e. when backtest gain >= 0.25%. The only way is manual interference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
// dax 1min once enterdate= 20190909 once entertime=090000 once closedate=enterdate once closetime=155500 // backtest price once BTbuyprice=12209.4 once BTsellprice=0 // real live price once RLbuyprice =12215.2 once RLsellprice=0 // check when trade starts if date=enterdate and time=entertime then TradeOn=1 endif // check when trade ends if date=closedate and time=closetime then TradeOFF=1 endif if TradeOn then if TradeOff=0 then if (RLbuyprice>0 and RLsellprice=0) and (BTbuyprice>0 and BTsellprice=0) then BTpositionperformance=((close/BTbuyprice)-1)*100 RLpositionperformance=((close/RLbuyprice)-1)*100 Offset=RLpositionperformance-BTpositionperformance elsif (RLbuyprice=0 and RLsellprice>0) and (BTbuyprice=0 and BTsellprice>0) then BTpositionperformance=((close/BTsellprice)-1)*100 RLpositionperformance=((close/RLsellprice)-1)*100 Offset=RLpositionperformance-BTpositionperformance endif endif endif if TradeOn=1 and TradeOFF=1 then RLpositionperformance=0 BTpositionperformance=0 TradeOn=0 TradeOff=0 Offset=0 endif return BTpositionperformance as "BTpositionperformance",RLpositionperformance as "RLpositionperformance", Offset as "Offset %" |
As example, the backtest had 3 trades today and all won. Say the total is 100%. The 3 winning live trades produced 62% compared to the backtest. I wondered how could I prevent such differences.
Working with % for the breakeven and trailing-stop, it’s black & white and if the real paid price with slippage & spread difference too much from the backtest price it could influence results, in a good or bad way especially in small ranging markets or with big retracements.
I use excel to compare sometimes the real vs backtest trades and as experiment coded this comparison-indicator. I thought maybe this could be the basis from something more, but it’s not.
It’s in part unavoidable and more visible in short term trading.
oh ok! I got it. You are right to say that the results may differ a lot when trading on shorter timeframes, especially because of slippage and spread. I’m afraid there is no easy way to simulate it.
If you are using market orders, you could try using pending stop orders with a random +/- points value around the close.
Find exclusive trading pro-tools on