Error 3 Invalid Trade Parameters

 

Hello guys! I have an issue with my EA. 

It is giving this Error 3 Invalid Trade Parameters but only if I use it on lower timeframes ( lower then M4). On M4 or Daily time is working fine. My SL and TP are calculated as per ATR value...also lotsize...maybe on lower timeframes lotsize cannot be calculated as per broker requirements ?!... I mean on my broker can only set lotsize multiple of 0.01...i

Please find my code below:



//Stoploss Calculation
   int stoploss;


   if(StopLoss==0)
     {
      stoploss=(int)(ATR*ATRMultiplier/_Point);
     }
   else(stoploss=0);


   int SL= StopLoss+stoploss;

//TakeProfit Calculation
   int takeprofit;

   if(TakeProfit==0)
     {
      takeprofit=(int)(ATR/_Point);
     }
   else(takeprofit=0);

   int TP=TakeProfit+takeprofit;

// Money management
   double lotSize = FixedLotSize;
   if(UseMoneyManagement == true)
     {
      lotSize = MoneyManagement(_Symbol,FixedLotSize,RiskPercent,SL);
    
     }
//
//
//
// if condition are true  => buy order

 {
         
         double PP=0;
         if(ClosePips > 0)
           {
            PP = Ask + NormalizeDouble(at(1)*ClosePips,_Digits);
           }
         int ticket = OrderSend(_Symbol,OP_BUY,lotSize,Ask,Slippage,0,0,"Buy Order",MagicNumber,0,clrGreen);
         GVSet("tp",PP);
         ModifyStopsByPoints(ticket,SL,TP);
         DrawVLine(PP);

   }

// if sell conditions true => sell order 

 {

            double PP=0;
            if(ClosePips > 0)
              {
               PP = Bid - NormalizeDouble(at(1)*ClosePips,_Digits);
              }
            int ticket = OrderSend(_Symbol,OP_SELL,lotSize,Bid,Slippage,0,0,"Sell Order",MagicNumber,0,clrRed);
            GVSet("tp",PP);
            ModifyStopsByPoints(ticket,SL,TP);
        
            DrawVLine(PP);

  }

// // //  // // //

// at(1) => atr value 
//PP => first TAKE PROFit
//ClosePips => procent of first TP