Pro order different from probacktest

Forums ProRealTime English forum ProOrder support Pro order different from probacktest

Viewing 15 posts - 1 through 15 (of 42 total)
  • #189194

    hello, I have a discrepancy between pro backtest and pro order. They mostly seem synchronised but only on the loosing trades. the live code took a few loosing trades that the backtest didn’t take. And the live code hardly took any of  the winning trades that the backtest did take which which reduces a 45% accurate backtest down to 2% accurate on live. I overcompensated for the spread on the backtest to account for a bit of slippage here and there.

    The code is exactly the same I run a backtest and then from there prepare for automated trading and run them side by side to compare the difference.

    Is there anything I can do to resolve this? or are these codes not able to replicate a backtest on live money?

    I found it funny how the discrepancy was the live code only took loosing trades and not one winning trade and not the other way round.  is there anything behind this or is it just bad luck?

     

    #189197

    Hi, you have ticked by tick mode

    #189207

    I have tested the results both with and without tick by tick mode there’s hardly any difference in results

    #189209

    Have you got both Longs and Shorts position size > minimum size for the Instrument you are trading?

    Have you got spread set in backtest engine at same value as the strategy will experience when trading live?

     

    #189214

    Thanks for your reply. Yes, i have checked the minimum trade size for the asset and set it to that. and i have backtested the code with a larger spread than it will be on live so if anything it should be better.

    The majority of the issue seems to be on execution, the live is taking all of the loosing trades the backtest takes but doesn’t get into the trades that win. Also the live code got stopped out of a few winning trades before they went on to win whereas the backtest code didn’t get stopped out and went on to win. The spread is higher on my backtest than on the live to make sure i am testing for the wort possible case scenario.

    #189215

    You’ve not said what is the Instrument?

    If it’s Forex then you may be getting a lot of flash (few milliseconds) widening of the spread and that is hitting your stop, whereas no such flash spread occurs in backtest.  Add the Indicator – Bid Ask band to yuor chart and you can see the flash wideing of the spread!

    If you post your code on here then I would run it on my platform and see if I come up with anything?

    But also the coding wizards on here would take a look at your code and advise any oddities likely to cause issues.

    #189216

    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

    1 user thanked author for this post.
    #189230

    You always have to start the backtest with the same day and time as when you put in Live, only in this way you are able to evaluate if there are any problems.
    So for example, if you start the live on March 9, 2022 at 10.00 also the backtest you have to do everything the same.
    Hello
    Mauro

    #189252

    Thankyou  all for your replies I really appreciate the help. I paid for this code to be done so that I can turn on and off different indicators and change parameters over multiple timeframes so that I can easily tailor the code to different assets using a range of tools. So I will explain clearly on here what exactly this is supposed to be doing so that you can ignore the rest and hone in on the parts being used.

    Timeframe 3 minutes

    buy trade to be taken when:

    EMA 3 > EMA6 [by 2 pips]

    EMA6 > EMA9 [by 8 pips]

    Price crosses over upper bollingerband [period 5] [standard dev 1.0]

    sell trade to be taken

    EMA 3 < EMA6 [by 2 pips]

    EMA6 < EMA9 [by 8 pips]

    Price crosses under lower bollingerband [period 5] [standard dev 1.0]

    Stop loss – 9

     Trailing stop – 7

    Risk-reward – 10  [the strategy is to get taken out by the trailing stop]

    If the signal is larger than 20pips take trade on 50% retracement of next candle [only]

     

    It doesn’t actually take the trades exactly how I want it to, even on the backtest so I think something is wrong on there somewhere, however I figured if it produces good results then it will be good to use anyway.

    The idea behind the strategy is for the code to detect short term buying and selling pressure and take an entry around where price is pushing hence the use of the bollinger band or 1 or 2 period EMA also works. And I want the code to execute the trade as it’s pushing with a tight trailing stop loss. And choosing an asset such as the NASDAQ that moves a long way allows to make a larger pip gain with short moves than say a forex pair. also the Spread for the NASDAQ is 1-2 pips the majority of the time.

    The code doesn’t actually seem to be taking the trades I feel that it should be taking when I’m looking at the charts.  I thought maybe the “signal larger than” parameter what causing the issue I have tried it without and it’s still not right. If you could take a look for me that would be great and please ask any further questions you might have.

     

    Thanks

    #189265

    This is better as then the coding wizards do not have to import to their platforms etc

    1 user thanked author for this post.
    #189266

    I’m surpised it runs at all as lotsize, trailingstopsize and stoplossdistance (Lines 66 to 84) are not defined anywhere?

    When I click on above in the code editor, the highllighter only shows the one instance of above (4 in the case of lotsize).

    Am I missing a trick here?? 🙂

    #189268

    Note: I defined lotsize = 1 at Line 63.

    This weirder and weirder … ‘google find’ says there are 13 mentions of lotsize on the page, I can see 8 and 3 of those are in my text. Google find is not highlighting the other 5 anywhere!?

    Is above a new way of hiding code or should I have gone to specsavers!!?? 🙂

     

    #189269

    Is above a new way of hiding code

    Yes it is GraHal … they are hidden in the optimiser as variables!! doh to me!!! 🙂

    I’ve got so used to my variables names being Line numbers (A10, B26 … etc) I was blind to varables as names!

    Specsavers, ring ring  … appointment please!! 🙂

     

    #189285

    Yes the reason for this is why I attached the file because there is deeper coding that you can’t see on a simple copy and paste. If you import the code you will see all of the missing values in the variable optimisation tab

    #189286

    I have a discrepancy between pro backtest and pro order

    It be good if you post your backtests results then we can start investigations from the same baseline?

     

Viewing 15 posts - 1 through 15 (of 42 total)

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