Is there anything I can do to resolve this? or are these codes not able to replicate a backtest on live money?
Hi there Jos,
Please take it from me that a backtest can be equal to live for, say 95 out of the 100 trades. Thus, 95 out of 100 will be equal to the penny.
BUT
Those 5 not equal will create a completely different flow/sequence of the further trades. And this is the first you did not see through yet (with respect of course).
Try this, in order to see what I mean : Start a Live system with little money, and start a Backtest with the same money and code. Take care that the first trade is synchronised in both (fiddle with the start time of the backtest in order to get there). The backtest will now run in “forward test” mode. Thus, just let it be and see what it does. Now, according to yourself you *will* see that a next order (starting with the exit and otherwise a next entry) will not be synchronised any more in both Live and Forward-Backtest). This is the point where I want you to be, because from that point on you will see that all your arguments for “not the same result” are moot.
All even includes you highering the spread in the backtest and expecting less profit from there. Eh, no; instead, all will be apples and oranges because the trade sequence is going to be different, and actually it is close to 50% whether you will make more or less money with the higher spread (on the very long term less for sure indeed).
If you, as GraHal asked, would show us the code in full, you can bet that we will be working on it to give you the hints on what the culprits and pitfalls could theoretically be (we won’t be executing your code in Live). Also hand the timeframe of the chart and indeed the instrument you run it on.
An almost infinite reasons exist allowing your backtest results to be be different from Live and this is mostly related to our perception of how markets are and react. You will undoubtedly see responses like “yea, no wonder, because you challenge for …” etc. (it is useless to give real examples at this moment). But … I am afraid that you will also see that whatever it exactly is that’s going off, mostly can’t be tackled by you. This is related to the enormous amount of time involved to get it right on one hand, and the required creativity and coding skills on the other. And we can’t demand from anyone that he can spend this time and has all the skills. And for example, possibly all people reading about my said “95 out of 100” will say, “yea sure !” (not believing that at all).
As far as I can tell myself, there’s at least one area where the backtesting will be off compared to reality : accumulated orders. PRT’s backtesting engine lacks the proper features for maintaining the gain accurately so much so, that I can’t get it to “synchronise” with even a single trade (a first does not end up equal, therefore does not end up equally in time, and therefore the sequence hence trades are not the same from the start). Once could also attest that now my own creativity etc. has its limits, or I just did not find the way.
Apologies for all the blathering, but I think it’s all good things to know for everyone, especially the mere beginners with AutoTrading.
Regards,
Peter