Backtesting and demo account algo doesn’t match live algo?

Forums ProRealTime English forum ProOrder support Backtesting and demo account algo doesn’t match live algo?

Viewing 3 posts - 1 through 3 (of 3 total)
  • #175689

    Hello, I have recently been screwed over by an algorithm for a reason that I cannot determine, I wonder whether anyone can help shed some light on the situation…

    I am running an algorithm on both my live and demo accounts, mostly because I forgot to stop it on my demo account. When I backtest this algorithm it displays a small loss this morning, a large gain yesterday and a handful of other trades over the past few weeks. By contrast, the algorithm running on my demo account did not make any trades at all in the last couple of days, and the algorithm running on my live account made a big loss on a trade that ran both yesterday and today.

    Is the platform broken? Why would a demo account and a live account make different trades using the same algorithm? Why would the backtest, even when running in tick-by-tick mode, show trades that didn’t happen, or not show trades that did happen? I am very confused about this whole thing, I know that a backtest isn’t 100% perfect but over 2 days it should be fairly accurate, right? Not showing a £300 gain when I actually made a £244 loss? Is there anything I can do to fix this that I might be missing?

    I have attached the algorithm that I have been running on 30m GBP/USD. Disclaimer, I did not write it, I just ran a decent amount of tests against it and had it in a demo account for a few months.

    #175691

    I have not read your strategy code yet, but attached is a non-exhaustive list of the elements that can impact a live trading strategy and create differences with a demo account and/or backtests, that could help you:

    • Spread
    • Slippage
    • Orders rejections due to one of the above reason, but also because of the allowed distance from current price to put pending orders (known as “minimal distance”)
    • Different trading hours (ProOrder code launched in a different time zone / custom hours, by the user)
    • Coding problem: division by zero error, null or negative periods for indicators, ..
    • Lack of responsiveness of IG demo servers (if IG is the broker), although this has improved considerably since last year.
    • Make backtests without tick-by-tick option
    • “set stop trailing” instruction that give IG the total control of your stoploss, can be moved differently between accounts due to points above
    • Limited risk accounts and their rules
    • Guaranteed stoploss rules and fees
    • Starting a strategy at a different time (1 hour or even 1 minute later): depending on the code of the strategy, the results of some calculations could be different.
    • Margin required on the trading account (no demo or backtest tests are made on this subject)
    • Overnight and overweekend fees
    Because backtests are only tested on history *with no connection to live market* , you may encounter differences with real live trading environment subject to spread enlargement, slippage, etc. If your stop hasn’t move, there must be information of an error into your orders rejected list you can consult with CTRL+O.
    IG orders list history may be also helpful!
    #175692

    Here is the full code for convenient read:

     

    Try to change line 13 with:

    to prevent period with decimal!

Viewing 3 posts - 1 through 3 (of 3 total)

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