trailing stop based on higher lows

Forums ProRealTime English forum ProOrder support trailing stop based on higher lows

Viewing 6 posts - 1 through 6 (of 6 total)
  • #191155

    hi! Need a little help for an individual stoploss. let’s take a simple setup for an entry condition:

    1
    2
    3
    4
    PatternToday = range > 5*PipSize   //range = high – low
    IF high > high[1] AND PatternToday[1] AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF

    now I would like to build a simple, but effective trailing stoploss just like in the image:

    • after the entry, the first stop will be the low of the entry bar
    • if the next bar’s low is higher, then this will become the new stoploss level
    • if the next bar’s low is not higher, either the old stoploss level will remain, or like in the graphic, it will trigger a sell order

    any help is much appreciated. Thank you.

    #191186

    There you go:

    3 users thanked author for this post.
    #191196

    Link to code above saved as Log 317 here …

    Snippet Link Library

    2 users thanked author for this post.
    #197655

    Hi,

    Chanced upon this idea and found it to be really useful. I wanted to make some tweaks to it and would greatly appreciate some help to double check if I’ve coded it correctly. If i wanted the stop loss to be at the lows/highs of the previous candle instead of the entry candle and for subsequent candles, to be at the lows/highs of the previous candles as well, is this the correct code for it?

    Thanks in advance!

    #197711

    I changed it this way:

     

    2 users thanked author for this post.
    #197718

    Link to above added as Log 331 here …

    Snippet Link Library

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

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