title: Stop order won't trigger Pine Script
body: <p>I am debugging my pine script, and so I put labels on each candle to track target and stop ticks but for some reason the stoploss just won't trigger</p>
  <p>The number on top is target ticks and that on bottom is stop loss ticks
  <a href="https://i.stack.imgur.com/1NQ05.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1NQ05.png" alt="enter image description here" /></a></p>
  <pre><code>float targetLTick = na
  float stopLTick = na
  
  if(longCondition)
      strategy.entry(&quot;Long Buy&quot;,true,1,comment =&quot;Long Buy \n&quot; + &quot;Target is &quot; + tostring(targetLR) + &quot;\n&quot; + &quot;StopLoss is &quot; + tostring(stopLR))
      //label.new(bar_index,high,,color = color.white)
      
  if(longCondition and strategy.position_size == 0)
      //average_long    = close
      targetLTick     := (targetLR - close) / syminfo.mintick
      stopLTick       := (close - stopLR) / syminfo.mintick
      
      label.new(x= bar_index,y= high, text = &quot;Target ticks = &quot; + tostring(targetLTick) +&quot;\n&quot;+&quot; Stoploss ticks = &quot; + tostring(stopLTick),textcolor = color.white)
  
  if(strategy.position_size &gt; 0)
      targetLTick := targetLTick[1]
      stopLTick   := stopLTick[1]
      label.new(x= bar_index,y= high, text =tostring(targetLTick) +&quot;\n&quot;+ tostring(stopLTick),textcolor = color.white)
  
  strategy.exit(&quot;Long Buy&quot;,   profit = targetLTick,   comment = &quot;Take Profit&quot;)
  strategy.exit(&quot;Long Buy&quot;,   stop = stopLTick,       comment = &quot;Book Loss&quot;)
  
  strategy.close_all(when = closing_Bell,comment = &quot;Closing Bell&quot;)  
  </code></pre>