My EA is not making buy and sell tickets

 
Guys, I need help, please! I'm with an EA for my strategy. But it turns out he's not making buy-and-sell market entries! I searched a lot for the internet but I can not find the error in the configuration. Follow EA OrderSend:

//+------------------------------------------------------------------+
//|  SendOrder                                                       |
//+------------------------------------------------------------------+
 bool SendOrder(int position, string comment)
  {
   datetime expiration=0;
   double price = 0;
   Lots = SL = TP = 0;
   
   for (int SO = 0; (SO < 50) && IsTradeContextBusy(); SO++) Sleep(100);
   
   RefreshRates();
   double LinesHeight = NormalizeDouble(High[ZigHCandel[0]]-Low[ZigLCandel[0]], Digits);
   
   if (position==OP_BUY){
      price=NormalizeDouble(Ask,Digits);
      SL = NormalizeDouble(price - ATRCheck()*10, Digits); //NormalizeDouble(price - LinesHeight, Digits);  // NormalizeDouble((Low[ZigLCandel[0]]+Low[ZigLCandel[1]]+Low[ZigLCandel[2]])/3, Digits);  
      TP = price + LinesHeight;
      Lots=CheckLots(Risk_Percentage, (Bid-SL)/Point , StaticLot);
      if ( (SL/Point > MaxStopLoss*Point) && MaxStopLoss > 0 ) { error("SL is higher than MaxStopLoss.");  SL = NormalizeDouble(price - MaxStopLoss*Point, Digits); }
      if ( (TP/Point > TakeProfit*Point) && TakeProfit > 0 )   { error("TP is higher than TakeProfit.");  TP = NormalizeDouble(price + TakeProfit*Point, Digits);  }
      Print("buy price:" + DoubleToStr(price, Digits) + " SL: " + DoubleToStr(SL, Digits) + " TP: "+ DoubleToStr(TP,Digits) ); 
      expiration=0;
      }
      
   if (position==OP_SELL){
      price=NormalizeDouble(Bid,Digits);
      SL = NormalizeDouble(price + ATRCheck()*10, Digits); //NormalizeDouble(price + LinesHeight, Digits);
      TP = price - LinesHeight;
      Lots=CheckLots(Risk_Percentage, (SL-Ask)/Point, StaticLot);
      Print("sell price:" + DoubleToStr(price, Digits) + " SL: " + DoubleToStr(SL, Digits) + " TP: "+ DoubleToStr(TP,Digits) );  
      if ( ( SL-price > MaxStopLoss*Point ) && MaxStopLoss >0 ) {   SL = NormalizeDouble(price + MaxStopLoss*Point, Digits);  }
      if ( ( TP > TakeProfit*Point  ) && TakeProfit  >0 ) {   TP = NormalizeDouble(price - TakeProfit*Point, Digits);   }
      expiration=0;
      }
      
   if (position==OP_BUY)
    ticket=OrderSend( Symbol(), OP_BUY, 0.1, Ask, 5, 200, 500, "My Order", 303030, 0, clrGreen );
   if (position==OP_SELL)
    ticket=OrderSend( Symbol(), OP_SELL, 0.1, Bid, 5, 200, 500, "My Order", 303030, 0, clrRed );
   try=1;
   while(ticket < 0 )
    {
      try++;
      if (try==RETRYCOUNT) { Print( "OrderSend Error: ",GetLastError()," SL=",SL," TP=",TP ); return(false);    }
      Sleep(RETRYDELAY);
      RefreshRates();
      if (position==OP_BUY)
         ticket=OrderSend( Symbol(), OP_BUY, 0.1, Ask, 5, 200, 500, "My Order", 303030, 0, Green );
      if (position==OP_SELL)
         ticket=OrderSend( Symbol(), OP_SELL, 0.1, Bid, 5, 200, 500, "My Order", 303030, 0, Red );
     }
    if (ticket > 0) LastOrderTime = TimeCurrent();   
    try=1;
    if (SL>0 || TP>0)
    while(  !OrderModify(ticket, price, SL, TP, expiration) )
     {
      if (try==RETRYCOUNT) {    Print( "OrderSend Error: ",GetLastError()," SL=",SL," TP=",TP ); return(false);    }
      try++;
      Sleep(RETRYDELAY);
     }
      return(true);
}  
 
  1. Have you checked whether you function SendOrder() is called?
  2. Have you checked the logs?
  3. Let your EA run either live (demo account) or in the strategy tester and print with Comment() all the values of the relevant variables on the chart to solve your problem.
Reason: