trade.OpenOrder is not working

 

Hi all,

This code is supposed to open an order when the 200 EMA crosses the 800 EMA, but it isn't working. Any thoughts? It's the first time I've used trade.OpenOrder so it could easily be a dumb mistake.

   if(IsNewBar)
      {
      if(valEMA_200_15M[2] > valEMA_800_15M[2])
         {
         if(valEMA_200_15M[1] < valEMA_800_15M[1])
            {
            trade.OrderOpen(_Symbol, ORDER_TYPE_SELL, buy_tradevol, valEMA_800_15M[0], valEMA_50_15M[0], valEMA_200_15M[0], lower_donchian[ArrayMinimum(lower_donchian, 0, 99)], ORDER_TIME_GTC, 0, "Buy crossover hedge");
            Print("downward crossover");
            }
         }
      }
      
      
   if(IsNewBar)
      {
      if(valEMA_200_15M[2] < valEMA_800_15M[2])
         {
         if(valEMA_200_15M[1] > valEMA_800_15M[1])
            {
            trade.OrderOpen(_Symbol, ORDER_TYPE_BUY, sell_tradevol, valEMA_800_15M[0], valEMA_50_15M[0], valEMA_200_15M[0], upper_donchian[ArrayMaximum(upper_donchian, 0, 99)], ORDER_TIME_GTC, 0, "Sell crossover hedge");
            Print("upward crossover");
            }
         }
      }