Trailing stop / Coder needed ;)

Forums ProRealTime English forum ProOrder support Trailing stop / Coder needed ;)

Viewing 5 posts - 1 through 5 (of 5 total)
  • #46529

    Dear all,

    Good afternoon.

    I do like the attached stop (THX) however I was wondering if one of you would be able to “modify/tweak” it as follows:

    //In order to reduce gradually the distance between opened trade and initial stop,

    After (n) bars, stop to move (n) pts Higher (if long), or lower (if short)

    Of course, if the trade moves in the right direction i.e. 35pts, then this last one takes over to the gradually one…

    Is my explanation clear ? Does this make sense for anyone ?

    I would be delighted to share the results on any given strategy.

    Thx you gents.

    DJ

     

    #46531

    You can start to count the bars when you are onmarket.

     

    Now, every bar you decrease the trailing distance by “number of bars” onmarket.

    That’s the idea, maybe?

    #46533

    Thx Derek,

    Looks good and I am sure it is…

    But what about the OCO condition: Like if the position is going positive and crosses the 34 pts onbarclosed, a code might say cxl the timer somewhere ?

    What do you think ?

    Thx again 😉

     

    #46628

    Hey Inertia,

    you can adapt the break-even code from the blog to start the trailing stop.

    https://www.prorealcode.com/blog/learning/breakeven-code-automated-trading-strategy/

    I guess the function for decreasing the trailing distance is dependent on your risk appetite,  the type of strategy, like for example the initial distance etc…

    You can get around the problem(?) of the barcounting variable by adding a second variable and replacing init_timer in the function for the priceexit.

    1 user thanked author for this post.
    #46629

    Here is the code for including a predefined starting distance for the risk function in your exit order decision:

    2 users thanked author for this post.
Viewing 5 posts - 1 through 5 (of 5 total)

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