0

I want to set a stoploss at previous low of long entry. which command I need to use ?

(https://i.stack.imgur.com/c9imo.png)

currently I use

if ta.change(strategy.position_size) == 0
    strategy.exit(id="Close Long", stop=low)


if ta.change(strategy.position_size) == 0
    strategy.exit(id="Close Short", stop=high)

1 Answers1

0

To detect the lowest value of a given number of bars back, you can use :

lowest_value = ta.lowest(close,10)

It will give you the lowest value available on the 10 bars back.

G.Lebret
  • 2,826
  • 2
  • 16
  • 27