title: How can this complex TradingView strategy be converted into an alert for 3commas trading bot?
body: <p>I am entirely new to code and was following a YT tutorial to convert TV strategies to studies with alerts for short and long positions. These alerts aim to notify two 3commas bots (one long and one short) to place trades automatically.</p>
  <p>My issue arose when I failed to identify the longSignal and its closing signal and the shortSignal and its closing signal. Unlike the strategy script in the YT tutorial, this script contains no mentions of long or short signals.</p>
  <p>I attempted using the Pine tutorials on Kodify to understand the issue and how it may be solved, but evidently, I am not fit to identify an appropriate solution. If someone could point me in the right direction, it would be greatly appreciated.</p>
  <p>This is the script for the strategy:</p>
  <pre><code>//@version=4
  strategy(&quot;The Strategy&quot;, overlay=true)
  start = input(0.02)
  increment = input(0.02)
  maximum = input(0.2)
  var bool uptrend = na
  var float EP = na
  var float SAR = na
  var float AF = start
  var float nextBarSAR = na
  if bar_index &gt; 0
      firstTrendBar = false
      SAR := nextBarSAR
      if bar_index == 1
          float prevSAR = na
          float prevEP = na
          lowPrev = low[1]
          highPrev = high[1]
          closeCur = close
          closePrev = close[1]
          if closeCur &gt; closePrev
              uptrend := true
              EP := high
              prevSAR := lowPrev
              prevEP := high
          else
              uptrend := false
              EP := low
              prevSAR := highPrev
              prevEP := low
          firstTrendBar := true
          SAR := prevSAR + start * (prevEP - prevSAR)
      if uptrend
          if SAR &gt; low
              firstTrendBar := true
              uptrend := false
              SAR := max(EP, high)
              EP := low
              AF := start
      else
          if SAR &lt; high
              firstTrendBar := true
              uptrend := true
              SAR := min(EP, low)
              EP := high
              AF := start
      if not firstTrendBar
          if uptrend
              if high &gt; EP
                  EP := high
                  AF := min(AF + increment, maximum)
          else
              if low &lt; EP
                  EP := low
                  AF := min(AF + increment, maximum)
      if uptrend
          SAR := min(SAR, low[1])
          if bar_index &gt; 1
              SAR := min(SAR, low[2])
      else
          SAR := max(SAR, high[1])
          if bar_index &gt; 1
              SAR := max(SAR, high[2])
      nextBarSAR := SAR + AF * (EP - SAR)
      if barstate.isconfirmed
          if uptrend
              strategy.entry(&quot;Short&quot;, strategy.short, stop=nextBarSAR, comment=&quot;Short&quot;)
              strategy.cancel(&quot;Long&quot;)
          else
              strategy.entry(&quot;Long&quot;, strategy.long, stop=nextBarSAR, comment=&quot;Long&quot;)
              strategy.cancel(&quot;Short&quot;)
  plot(SAR, style=plot.style_cross, linewidth=3, color=color.orange)
  plot(nextBarSAR, style=plot.style_cross, linewidth=3, color=color.aqua)
  //plot(strategy.equity, title=&quot;equity&quot;, color=color.red, linewidth=2, style=plot.style_areabr)```
  </code></pre>