title: In tradingview, pine script function strategy.exit doesn't work if take profit and stop loss were set separately instead of a single line
body: <p>The following code works for me when I try to set the stop loss and take profit level:</p>
  <pre><code>strategy.exit(&quot;TP/SL 1&quot;, &quot;Long Entry 1&quot;,  stop = long_stop_level,  limit = long_profit_level)
  </code></pre>
  <p>But the issue for this code is that it will not tell me it is a stop loss exit or take profit exit.. so I tried to split it off to the following manner:</p>
  <pre><code>strategy.exit(&quot;SL 1&quot;, &quot;Long Entry 1&quot;,  stop = long_stop_level)
  strategy.exit(&quot;TP 1&quot;, &quot;Long Entry 1&quot;,  limit = long_profit_level)
  </code></pre>
  <p>But I notice that only the stop loss is working but not the take profit, is there anyway I could fix that?</p>