EA doesn't place trades

 
//+------------------------------------------------------------------+
//| Input variables                                                  |
//+------------------------------------------------------------------+
input int Stoploss = 50, Takeprofit = 100;
input double Tradevol = 0.1;
//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
bool glBuyPlaced, glSellPlaced, openPosition = PositionSelect(_Symbol);
long positionType = PositionGetInteger(POSITION_TYPE);
long sellCounter = 0, buyCounter= 0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   sellCounter = 0;
   buyCounter = 0;
   glBuyPlaced = false;
   glSellPlaced = false;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
//--- Declare the trade classes
   MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request);

//--- Define the array to hold the close and open prices
   MqlRates rates[]; ArraySetAsSeries(rates,true);
   CopyRates(_Symbol,_Period,0,10,rates);
//+------------------------------------------------------------------+
//| Buy order                                                        |
//+------------------------------------------------------------------+
   if(glBuyPlaced == false && (openPosition == false || positionType != POSITION_TYPE_BUY))
   {
      double positionOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN);
      if(rates[0].close > rates[0].open)
      {
         if(rates[1].close > rates[1].open)
         {
            if(rates[2].close < rates[2].open)
            {
               request.action = TRADE_ACTION_DEAL;
               request.type = ORDER_TYPE_BUY;
               request.symbol = _Symbol;
               request.volume = Tradevol;
               request.price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
               request.deviation = 9;
               request.sl = SymbolInfoDouble(_Symbol,SYMBOL_BID) - (100 * _Point);
               request.tp = SymbolInfoDouble(_Symbol,SYMBOL_ASK) + (Takeprofit * _Point);
               request.type_filling = ORDER_FILLING_IOC;

               if(!OrderSend(request,result))
               Print("Error");
            }
         }
      }
      glBuyPlaced = true; glSellPlaced = false;
   }
//+------------------------------------------------------------------+
//| Sell market order                                                |
//+------------------------------------------------------------------+
   if(glSellPlaced == false && (openPosition == false || positionType != POSITION_TYPE_SELL))
   {
      double positionOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN);
      if(rates[0].close < rates[0].open)
      {
         if(rates[1].close < rates[1].open)
         {
            if(rates[2].close > rates[2].open)
            {
               request.action = TRADE_ACTION_DEAL;
               request.type = ORDER_TYPE_SELL;
               request.symbol = _Symbol;
               request.price = SymbolInfoDouble(_Symbol,SYMBOL_BID);
               request.volume = Tradevol;
               request.deviation = 9;
               request.sl = SymbolInfoDouble(_Symbol,SYMBOL_ASK) + (Stoploss * _Point);
               request.tp = SymbolInfoDouble(_Symbol,SYMBOL_BID) - (Takeprofit * _Point);
               request.type_filling = ORDER_FILLING_IOC;

               if(!OrderSend(request,result))
               Print("Error");
            }
         }
      }
      glBuyPlaced = false; glSellPlaced = true;
   }
}

pls can someone help.....my EA does not place trades

 

Do not double/triple post!

I have deleted your other 2 duplicate topics.

Correction - your other 3 topics!

 
udoh.jeremiah.emem:

pls can someone help.....my EA does not place trades

Do you get any kind of error messages?
 

Dedicated code - it makes no sense:

//+------------------------------------------------------------------+
//| Input variables                                                  |
//+------------------------------------------------------------------+
input int Stoploss = 50, Takeprofit = 100;
input double Tradevol = 0.1;
//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
bool glBuyPlaced, glSellPlaced, openPosition = PositionSelect(_Symbol);
long positionType = PositionGetInteger(POSITION_TYPE);

I recommend doing this - in the input parameters, set the position type:

//--- input parameters
input ENUM_POSITION_TYPE InpPositionType = POSITION_TYPE_BUY; // Position Type