Page 1 of 1
Adding ATR stop to strategy script
Posted: Fri May 20, 2022 2:07 pm
by banuzi
hey guys , any idea how to add an ATR stop/take profit to a strategy script . thanks
Re: Adding ATR stop to strategy script
Posted: Fri May 20, 2022 5:08 pm
by banuzi
Any idea how to add atr based stops/take-profits in a strategy script ? I can't reference the strategy(entry) function because it cannot be declared as a variable. thanks
Re: Adding ATR stop to strategy script
Posted: Sun Feb 05, 2023 10:24 am
by processingclouds
You can use stop parameter in strategy.entry to define stop any value .
To take profit you can have something like
tp = 10
if (strategy.position_size > 0)
strategy.exit(id="TakeProfit", from_entry="Long", profit=takeProfitAtValue)