MT5 EA doesnt trade

 
Hi guys, Im quite new to mql5 ,so im having a few problems with making the EA trade.Im attaching the code.
int OnInit()
  {
//---
   point=Point();
   if(Digits()==3 || Digits()==5) point*=10;

   ExtTrade.SetExpertMagicNumber(MA_MAGIC);
   ExtTrade.SetMarginMode();
   ExtTrade.SetTypeFillingBySymbol(Symbol());
//-----
   MAhandle=iMA(_Symbol,_Period,maperiod,0,mamethod,maprice);
   if(MAhandle==INVALID_HANDLE)
     {
      printf("Error creating MA indicator");
      return(INIT_FAILED);
     }
    MACDhandle=iMACD(_Symbol,_Period,fastma,slowma,signalma,maprice);
   if(MACDhandle==INVALID_HANDLE)
     {
      printf("Error creating MACD indicator");
      return(INIT_FAILED);
     }
    ADXhandle=iADX(_Symbol,_Period,adxperiod);
   if(ADXhandle==INVALID_HANDLE)
     {
      printf("Error creating ADX indicator");
      return(INIT_FAILED);
     }
  
  
//---
   return(INIT_SUCCEEDED);
  }
void OnTick()
  {
//---
CheckForOpen();
  }
//+------------------------------------------------------------------+
void CheckForOpen(void)
  {
   MqlRates rt[2];
//--- go trading only for first ticks of new bar
   if(CopyRates(_Symbol,_Period,0,2,rt)!=2)
     {
      Print("CopyRates of ",_Symbol," failed, no history");
      return;
     }
   if(rt[1].tick_volume>1)
      return;
//--- get current Moving Average 
   double   ma[2];
   double adxmin[2];
   double adxplus[2];
   double macd[2];
   
   if(CopyBuffer(MAhandle,0,0,2,ma)!=2)
     {
      Print("CopyBuffer from iMA failed, no data");
      return;
     }
  if(CopyBuffer(MACDhandle,0,0,2,macd)!=2)
     {
     Print("CopyBuffer from MACD failed, no data");
     return;
     }   
  if(CopyBuffer(ADXhandle,1,0,2,adxplus)!=2)
     {
     Print("CopyBuffer from ADX plus failed, no data");
     return;
     }   
  if(CopyBuffer(ADXhandle,2,0,2,adxmin)!=2)
     {
     Print("CopyBuffer from ADX minus failed, no data");
     return;
     }   
     
//--- check signals
   ENUM_ORDER_TYPE signal=WRONG_VALUE;
 double SL=0,TP=0;
   if(!AreThereOrders() && rt[1].close<ma[1] && rt[1].open>ma[1] && rt[0].close<ma[0] && rt[1].open>rt[1].close && rt[0].open>rt[0].close
      && adxplus[0]<adxplus[1] && adxmin[0]>adxmin[1]){
      signal=ORDER_TYPE_SELL;    // sell conditions
      SL=SYMBOL_BID+stoploss*point;
      TP=SYMBOL_BID-takeprofit*point;}
   else 
     {
      if(!AreThereOrders() && rt[1].close>ma[1] && rt[1].open<ma[1] && rt[0].close>ma[0] && rt[1].open<rt[1].close && rt[0].open<rt[0].close
      && adxplus[0]>adxplus[1] && adxmin[0]<adxmin[1] )
         signal=ORDER_TYPE_BUY;  // buy conditions
      SL=SYMBOL_ASK-stoploss*point;
      TP=SYMBOL_ASK+takeprofit*point;
         
     }
//--- additional checking
   if(signal!=WRONG_VALUE)
     {
      if(TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && Bars(_Symbol,_Period)>100)
         ExtTrade.PositionOpen(_Symbol,signal,lotsize,SymbolInfoDouble(_Symbol,signal==ORDER_TYPE_SELL ? SYMBOL_BID:SYMBOL_ASK),
                               SL,TP,NULL);
     }
//---
  }
 
Stanislav Ivanov:
Hi guys, Im quite new to mql5 ,so im having a few problems with making the EA trade.Im attaching the code.

Point() returns value of _Point, which is not you want in your code, the way you used it. (value of _Point constant is usually sth like 0.0001 or 0.00001 or 0.001 depending on broker and instrument)

Digits()  same as _Digits , return an integer, number of decimal digits for the symbol. (like 5 or 3 or 2 ...)

 
Figured it out - it was the Bid and Ask variable
Reason: