title: How to create Multiple Seperate Long Entry and Long Exit Orders in one script
body: <p>I am trying to figure out how to create multiple Long orders in one script.<br />
  For example, I put together one script that has 3 buy / sell conditions, and I would like each to have it's own entry / exit parameters.  Figuring out how to order multiple Long entries in one script is my current obstacle.</p>
  <p>There is currently a &quot;Main&quot;, a &quot;Fast&quot; and a &quot;Vol&quot; strategy.</p>
  <p>No matter what I try, each of these work by themselves but when run together whichever one is fastest essentially runs everything.  Maybe one out of 100 times a lower one will slip through, and then sometimes a different strat will Sell / go long on that trade instead of letting the strat that bought it determine when to sell it.</p>
  <p>Things I've tried includes nested loops and also strategy.oca groups.  I've been reviewing documentation but none of them demonstrate my scenario--the scenarios I found were multiple entries with one big exit.  I want each strat to enter and exit on it's own.  I have pyramiding on at 3.  I've tried using Strategy.position_size == 0 entries as well as trying to add a variable to stop a conditional from ordering if it already has an order but nothing I've tried works.<br />
  If it matters, I will not be using any margin.</p>
  <pre><code>if OrderLong and not OrderShort
      strategy.cancel(id=&quot;Sell&quot;)
      strategy.entry(id=&quot;Buy&quot;, long=true, comment=&quot;Buy&quot;)  //strategy.entry(id=&quot;Buy&quot;, long=true, stop=high, comment=&quot;Buy&quot;, limit=(OrderLimit))
  
  if OrderShort and not OrderLong and not OrderShortFast
      strategy.cancel(id=&quot;Buy&quot;)
      strategy.exit(&quot;Sell&quot;, &quot;Buy&quot;, stop=low, limit=(OrderLimit),comment=&quot;Sell&quot;)
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    
  if OrderLongFast and not OrderShortFast
      strategy.cancel(id=&quot;SellFast&quot;)
      strategy.entry(id=&quot;BuyFast&quot;, long=true, comment=&quot;Buy Fast&quot;)           //strategy.entry(&quot;BuyFast&quot;, long=true, stop=high, comment=&quot;Buy Fast&quot;, limit=(OrderLimit))
  
           
  if OrderShortFast and not OrderShort
      strategy.cancel(id=&quot;BuyFast&quot;)
      strategy.exit(&quot;SellFast&quot;, &quot;BuyFast&quot;, stop=low, limit=(OrderLimit),comment=&quot;Sell Fast&quot;)    
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     
  if OrderLongVol
      strategy.cancel(id=&quot;SellVol&quot;)
      strategy.entry(id=&quot;BuyVol&quot;, long=true, comment=&quot;Buy Vol&quot;)           //strategy.entry(&quot;BuyFast&quot;, long=true, stop=high, comment=&quot;Buy Fast&quot;, limit=(OrderLimit))
  if OrderShortVol
      strategy.cancel(id=&quot;BuyVol&quot;)
      strategy.exit(&quot;SellVol&quot;, &quot;BuyVol&quot;, stop=low, limit=(OrderLimit),comment=&quot;Sell Vol&quot;)    
  </code></pre>