title: Tradingview ATR pine editor
body: <p>I need to calculate ATR take profit ( TP1, TP2, TP3) and stop loss (SL) on the exact candle as entry is. I can't find out how to avoid ATR movement with price moves. 
  I'm using this code right now, but its calculating latest price:</p>
  
  <pre><code>strategy.exit("TP1", "Short", qty_percent = 60, limit=atrMinus1)
  strategy.exit("TP2", "Short", qty_percent = 20, limit=atrMinus2)
  strategy.exit("TP3", "Short", qty_percent = 20, limit=atrMinus3)
  strategy.exit("SL", "Short, stop = atrStop)
  </code></pre>
  
  <p>Picture shows what I'm looking for</p>
  
  <p><a href="https://i.stack.imgur.com/GrFM5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GrFM5.png" alt="picture"></a></p>