SL at the lowest (highest) of the previous x bars for buy (sell) order

Forums ProRealTime English forum ProOrder support SL at the lowest (highest) of the previous x bars for buy (sell) order

Viewing 2 posts - 1 through 2 (of 2 total)
  • #68892

    Hi,

    I’d like to code a simple SL function:

    when the conditions for buy order are triggered, I want the stop loss to be put below the lowest of the previous x bars.

     

    Same for sell orders, above the highest of the previous  bars.

    Thanks for any help

    #68901

    This should work if I have understood right what you want. The stoploss price is set and an order set at the time of entry and an order placed every bar after that at that same stoploss price while you still on the market because the STOP orders need to be renewed at every new bar. Obviously change the [100] to whatever period you need for your lookback.

    Code the reverse with Highest[x](High and SellShort and ExitShort for short positions.

     

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

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