S&P500 Backtest shows different numbers than the Report

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #206636 quote
    GraHal
    Participant
    Master

    The Stop at Line 90 won’t be actioned because it is followed by another Stop at Line 93 … this is the way PRT works (weird I know?).

    90   SET STOP pLOSS max(myATR * 1.5,10)
    92    SET TARGET PPROFIT TP
    93    SET STOP PTRAILING SLT
    Khaled thanked this post
    #206639 quote
    Khaled
    Participant
    Veteran

    My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security

    #206640 quote
    Khaled
    Participant
    Veteran

    Sorry to come back with my issue. So now I optimized without “Tick by Tick” and when I plug the optimized variables into the system and then backtest the system the Report show negative P&L. Which one should I trust, the optimized values or the Report?

    #206642 quote
    PeterSt
    Participant
    Master

    Hi Khaled – Sadly, the report.
    It is what GraHal told … you should cause the Tick by Tick column to have an as low as possible value. You can think like this : each time a tick is counted there, the result in the optimisation is not reliable and always too positive. Live and Demo-Live will work with what the Statistics Report shows you. So you better listen to that report. 😉

    Khaled thanked this post
    #206643 quote
    PeterSt
    Participant
    Master

    The Stop at Line 90 won’t be actioned because it is followed by another Stop at Line 93 … this is the way PRT works (weird I know?).

    90 SET STOP pLOSS max(myATR * 1.5,10)
    92 SET TARGET PPROFIT TP
    93 SET STOP PTRAILING SLT

     

    My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security

    It is not about when it is triggered etc. The PRT interpreting system overrules a previous line in the code with similar action (STOP)  with a next it runs into. So line 90 will be overruled with line 93.
    What people additionally tell you is that line 93 in Live won’t work (I never tried it but believe them). It works in Backtest though (and even Live-Demo ?), so it is to be avoided (!).
    Net, both your Stop lines don’t work out.

    Khaled and GraHal thanked this post
    #206651 quote
    Khaled
    Participant
    Veteran

    What people additionally tell you is that line 93 in Live won’t work (I never tried it but believe them). It works in Backtest though (and even Live-Demo ?), so it is to be avoided (!).

    Thank you Peter. I searched and found a long list of codes which can replace the “SET STOP PTRAILING” instruction. Any code you can reommend please? (preferably per point and not per percentage) Thanks

    #206685 quote
    PeterSt
    Participant
    Master

    Hi Khaled,

    I am not experienced with any of the trailing stop codes which is the result of just never “following” them. However, I think that @robertogozzi will be able to point out the currently best or most extensive one. They are mostly relatively simple to integrate in your own code. Notice though that you should always carefully test them with Graph(OnPrice) commands so that you will know in advance their real effectiveness. Without such debugging you will be in the blind up to stops never occurring. Trailing stuff is sensitive and say that you can win half of the money with it (or not lose half of the money in this case).

    Regards,
    Peter

    PS: I actually wonder whether so many Trailing Stop codes pass the revue in PRC. Trailing Target, yes (much more easy).

    Khaled thanked this post
    #206694 quote
    GraHal
    Participant
    Master

    most extensive one.

    I think this is the most extensively used Trailing Stop code …

    https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/

    Khaled thanked this post
    #206707 quote
    PeterSt
    Participant
    Master

    I think it is quite easy to have a misunderstanding between a Trailing Target and a Trailing Stop(Losssss).
    Of course we can use the Trailing Stop to lock in our profit (used as a Trailing Target), but I wonder whether Khaled meant that.

    My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security

    But I must admit – I am not sure.
    So maybe for my fun only :

    PS: I actually wonder whether so many Trailing Stop codes pass the revue in PRC. Trailing Target, yes (much more easy).

    What people additionally tell you is that line 93 in Live won’t work (I never tried it but believe them). It works in Backtest though (and even Live-Demo ?), so it is to be avoided (!). Net, both your Stop lines don’t work out.

    This is not even correct as I use it all the time myself (crossed some wires once again). The one not working in Live (but works in BackTest and maybe only in PRT-IB) would be Set Stop Loss x Trailing y.

    Now hopefully doing it right :

     

    My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security

    The Set Stop pTrailing SLT perfectly works, also when you’re in a losing state. It trails under the price, which is possibly what you want after all, Khaled. Maybe off topic :

    Trailing above the price is something else and what I personally would call “Trailing Loss”. It can be used when you’re in a profit state just the same. Normally it would be used to take position but this is not necessary at all. Careful again : this is what is possible manually in PRT-IB. I use that all the time too. In my opinion this is lacking in AutoTrading, or I just don’t know how to do it**. Thus example : trail above the price for a Long position and the trailing goes downwards. When you already have a position this works just the same as well. And now you can use it to invert …
    This has its application when in a losing state as well, but the situation would be harder to grasp. It can lock in least-loss once you are sure to be losing, but wait for a retrace to make the best of it (and then invert on top of it).
    **): Technically the command involved can be applied, but because it is at the wrong side of the price, it is accepted as a Market order and nothing trails. Not so with Manual trading (IB).

     

    PS: What you, GraHal, linked to, is what I would call trailing (a) target. That this works with a Set Stop Trailing command is something else and confusing. In my personal view, @JC_Bywan has it right in this topic : Trailing Profit Target

    #206709 quote
    Khaled
    Participant
    Veteran

    Trailing Profit Target

    Thank you Peter. Indeed, what I’m looking for is a function that replicates the “pTrailing” that we use when we trade manually, i.e. moving the SL favorably (even if the position is not yet green) by x points when the price of the asset moves by y points. I’ve backtested a few codes found on PRC and the one which generates the best simulated results is the “pTrailing”. I’ll backtest again the codes proposed above by you (JC) and by GraHal and will see the difference.

    Thank you all for taking the time. Very helpful.

Viewing 10 posts - 16 through 25 (of 25 total)
  • You must be logged in to reply to this topic.

S&P500 Backtest shows different numbers than the Report


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Khaled @khaled Participant
Summary

This topic contains 24 replies,
has 5 voices, and was last updated by Khaled
3 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/01/2023
Status: Active
Attachments: 4 files
Logo Logo
Loading...