title: using automated code not executing correctly
body: <p>I am needing a code to buy when 10 ema crosses over the 20 and 50 and sell when the 10 crosses under the 20 and 50. </p>
  
  <p>The issues im having is with this code;</p>
  
  <pre><code>  // Definition of code parameters
  DEFPARAM CumulateOrders = False // Cumulating positions deactivated
  
  // Conditions to enter long positions
  indicator1 = ExponentialAverage[10](close)
  indicator2 = ExponentialAverage[20](close)
  c1 = (indicator1 CROSSES OVER indicator2 and  )
    indicator3 = ExponentialAverage[10](close)
  indicator4 = ExponentialAverage[50](close)
  c2 = (indicator3 CROSSES OVER indicator4)
  
  IF c1 and c2 THEN
  BUY 10 CONTRACT AT MARKET
  ENDIF
  
  // Conditions to exit long positions
  indicator5 = ExponentialAverage[10](close)
  indicator6 = ExponentialAverage[20](close)
  c3 = (indicator5 CROSSES UNDER indicator6)
  indicator7 = ExponentialAverage[10](close)
  indicator8 = ExponentialAverage[50](close)
  c4 = (indicator7 CROSSES UNDER indicator8)
  
  IF c3 AND c4 THEN
  SELL AT MARKET
  ENDIF
  </code></pre>
  
  <p>It is only buying when the 10 20 50 cross exactly at the same time. I do not want that, what i need is it to buy when it crosses both not necessarily at the same time. and the selling side the opposite.</p>
  
  <p>Thank you </p>