Stops and trailing stops

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #201130 quote
    Markscragg
    Participant
    New

    Can anyone help

    Yesterday for the first time in RTP I created an automatic trading order with the following risk management code

    // Stops and targets
    SET STOP pLOSS 100 pTRAILING 10
    SET TARGET pPROFIT 100

    PRT would not  accept this code with the message ‘Combined Stops can not be used with ProOrder’ although it is the default method when using simplified creation.

    So I resubmitted with the code

    // Stops and targets
    SET STOP pLOSS 100

    SET STOP pTRAILING 10
    SET TARGET pPROFIT 100

    which was accepted.

     

    However when I have backtested the two versions of the code I get very different results

    Can anyone explain why there is such a difference

    and how to use both a stop and trailing stop in ProOrder

     

    Regards

    Mark

    #201150 quote
    Markscragg
    Participant
    New

    thanks

    What are BBCodes and where can I find information on them

    Mark

    #201159 quote
    robertogozzi
    Moderator
    Master

    BBCodes: https://it.wikipedia.org/wiki/BBCode#Comandi_BBCode

    You solution:

    SET STOP pLOSS 100
    
    SET STOP pTRAILING 10

    is now formally correct, but SET STOP pLOSS 100 will ALWAYS be overridden by the next line SET STOP pTRAILING 10, as code is read sequentially. You have to use only one of the two lines or, if you need both a Stop Loss and a Trailing Stop, you have to use SET STOP pLOSS 100 then resort to a code snippet to append to your code to manage the trailing stop, like this one (lines 17-56): https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Stops and trailing stops


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Markscragg @markscragg Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by robertogozzi
3 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/21/2022
Status: Active
Attachments: No files
Logo Logo
Loading...