Dynamic Stop Loss Code Help!

Forums ProRealTime English forum ProOrder support Dynamic Stop Loss Code Help!

Viewing 4 posts - 1 through 4 (of 4 total)
  • #115064
    VN

    Hi, I am having difficulty implementing a stop loss strategy, which is as follows:

    EXAMPLE on DAX

    I open a SHORT at 13,300 with an initial STOP LOSS = 10, so I will get stopped if price rises to 13,010.

    But then I want to say, IF price moves down to 12,990, then move the stop level from 13,010 down to 13,000.

    I then want to introduce a tiered approach such that, if

    1. Price reaches 12,950 (X), set stop loss at 12,970 (Y)
    2. Price reaches 12,930 (X), set stop loss at 12,960 (Y)

    I will use X and Y as variables to denote the Current Price and StopLoss levels which I can set based on certain conditions, but I am using fixed prices here to illustrate my point.

    I am using the SET STOP pLOSS X pTRAILING Y instruction to do the above, but this doesn’t work.

    Would be grateful if anyone can help with how I can code this simple example.

    Thanks!

    #115114

    You will have better luck finding help with a strategy question if you post in the correct forum. ProBuilder is for indicators and ProOrder is for strategies. I will move your topic to the correct forum – please try to post in the correct forum with future topics.

    I have also tidied up the HTML mess that was in your post.

    #115118
    VN

    ok thanks for moving the post. Was not sure where is best to post it, hopefully now it will now be visible to people :).

    #120743

    Sorry for being so late, I hope you have found a solution.

    In case you haven’t… you’ll find the code you need, ready-made, from line 17 through line 56 at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.

     

Viewing 4 posts - 1 through 4 (of 4 total)

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