Difference in outcome backtest and automated trading

Forums ProRealTime English forum ProOrder support Difference in outcome backtest and automated trading

Viewing 15 posts - 1 through 15 (of 49 total)
  • #226209

    I’m seeking for help with the following:

    I have a big difference in the outcome of my system in the backtest and automated trading

    All settings are the same, including brokerage.

    I´m dealing automatic USD/JPY in the one hour time frame and today the automated trading had JPY 1.300 profit, where the backtest made an profit of JPY 10.550

    A difference of  92.5 pips and this is not the first time.

    Maybe I’m doing something wrong and if so, I’m happy to hear this

    I´m using Prorealtime V12 in the IG platform.

    Find below the screenshots of today

    Ps, when I use a larger trailing stop it makes no difference

    Thanks for your help

    Martin

    #226210

    Sorry I forgot to attach the files

    #226213

    Maybe turn on “tick by tick” and then see that the system doesn’t work that way?

    1 user thanked author for this post.
    #226261

    I tried it as well, but I’m keeping a big difference still.

    In the tick by tick method, the backtest performance is worse and live trading is much better.

    My main problem is the big difference between the backtesting in live modus and the automated trading

    They run both at the same time , but make a huge difference.

    The question who is wrong here, is odd as Prorealtime is getting the input from IG

    I´m really confused as I have the differences every day

    #226270

    Here are some clues about differences https://www.prorealcode.com/topic/backtesting-and-demo-account-algo-doesnt-match-live-algo/#post-175691.

    Try changing line 33 with a greater value, such as 10 or 20.

    A better solution would be to use a custom made trailing stop. here is the easiest to use https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/. Just comment out line 33, then append lines 17 through 56 from the code snippet. Its settings are 20 and 5, you may also try 20 and 10 or 20 and 20, etc…

    In this spreadsheet https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit#gid=0, maintained by GraHal, you will find so many links to useful code snippets.

     

    1 user thanked author for this post.
    #226278

    Really thanks for all the links Roberto.

    I will read them and see which one will work better.

    Probably I will have more questions afterwards and will come back to

    #226298

    Good afternoon Roberto,

    I looked over all solutions as well as the various the code snippets in the spreadsheet.

    As you said https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/ was the most easiest solution

    Only one problem, it is not working as it doesn’t stop when the trade is not in profit, like the normal trailing stop.

    Did I do something wrong? I attached my ITF file and a snapshot of yesterdays trading.

    Thanks for your help in this

    #226332

    That code was not made for that, it immediately sets the SL at breakeven once there is enough profit.

    This is another snippet you that does what you mean:

     

    2 users thanked author for this post.
    #226336

    Thanks Roberto, really appreciate your help in this.

    Unfortunately the latest solution does not work well in the system as it gives big losses, which I don’t have in live trading.

    My starting point was the big difference in live trading and backtest mode running simultaneously.

    As I’m  not using DMA, I’m  dependent on the input of IG and I’m aware that there are some differences, but in my opinion the differences are too big!

    I aiming to do 20 trades per day in the 1 hour TF and I don’t mind  to have 15 small losses, a long as the other 5 make up for the losses and preferably more.

    Therefore I´m using a small standard trailing stop.

    I´m just looking for a way to have more or less the same results in both systems simultaneously .

    Independently whether the system used is good or bad

    #226339

    I think 20 trades per day in a 1 hour time frame only sounds practical if the trade evaluation is done in a smaller time frame like 5 minutes or 1 minute.

    1 user thanked author for this post.
    #226378

    Hi there Martin,

     

    I applied two small changes at the // ! lines. Now it works technically OK. Whether functionally is up to you.
    Notice that in Backtest it was already wrong; please observe the immediate exits in your original code.

    I hope this helps you !
    Peter

     

    1 user thanked author for this post.
    #226380

    PS: I would never having those pending stop (at the end of your code) commands unconditionally.  This is because they inherently contradict. So make that under a condition LongOnMarket and ShortOnMarket respectively and it will be better again.

    1 user thanked author for this post.
    #226387

    Dear Peter, I really appreciate your help and your comments.

    I will make the tests during the night in live trading and will let you know the outcome.

    Thanks again,

    Martin

    #226389

    Thanks for your comment Phoentzs.

    Please take into account that I perform live trading with the system in the 1 hour TF and that I watch live what is happening.

    Therefore there is no direct need at this moment to analyse on the smaller TF

    I see live that there is a real discrepancy between the two systems and I’m looking for a way to minimize this discrepancy.

     

     

     

    #226395

    Apologies if already been discussed, but do you have the exact same spread set in the backtesting engine as in Live (varies over 24 hours)?

    Apart from a few points + or – in profit, differing spreads (backtest to Live) could even affect trades being placed or not (depending on code).

     

     

    1 user thanked author for this post.
Viewing 15 posts - 1 through 15 (of 49 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login