MT5 Not OrderSend & PositionOpen

Brian Lillard  

Problem with my EA is how order send works in MT5


Order send is generating a error as follows




Takeprofit & stoploss are set to zero / Start balance is 1000, leverage is 1000 , and here is the code


#include <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
CPositionInfo position;
CTrade trade;


void SendOrder(ENUM_ORDER_TYPE iType,double dLotSize)
 {
  ulong iTicket=0;
  for(int iRet=1; iRet<=Retries; iRet++)
   {
    UpdateLevels(iType,false);
    trade.SetDeviationInPoints(20);
    if(!trade.PositionOpen(Symbol(),iType,dLotSize,dPrice,dSL,dTP,"MyMt5EAv1"))
     {
      Sleep(1000);
     }
    else
     {
      iTicket=trade.ResultOrder();
     }
   }
  if(iTicket>0 && (StopLoss>0 || TakeProfit>0))
   {
    if(PositionSelectByTicket(iTicket))
     {
      if((StopLoss>0 && PositionGetDouble(POSITION_SL)==0) || (TakeProfit>0 && PositionGetDouble(POSITION_TP)==0))
       {
        for(int iRet=1; iRet<=Retries; iRet++)
         {
          UpdateLevels(iType,true);
          if(trade.PositionModify(iTicket,dSL,dTP)){break;}
          else{Sleep(1000);}
         }
       }
     }
   }
 }
void UpdateLevels(ENUM_ORDER_TYPE iType,bool bECN)
 {
  if(iType==ORDER_TYPE_BUY)
   {
    dPrice=NormalizeDouble((bECN?PositionGetDouble(POSITION_PRICE_OPEN):SymbolInfoDouble(Symbol(),SYMBOL_ASK)),_Digits);
    dSL=(StopLoss==0?0:NormalizeDouble(dPrice-Point()*StopLoss,_Digits));
    dTP=(TakeProfit==0?0:NormalizeDouble(dPrice+Point()*TakeProfit,_Digits));
   }
  else
   {
    dPrice=NormalizeDouble((bECN?PositionGetDouble(POSITION_PRICE_OPEN):SymbolInfoDouble(Symbol(),SYMBOL_BID)),_Digits);
    dSL=(StopLoss==0?0:NormalizeDouble(dPrice+Point()*StopLoss,_Digits));
    dTP=(TakeProfit==0?0:NormalizeDouble(dPrice-Point()*TakeProfit,_Digits));
   }
 }


Yea so ,what error is this that I can lookup? 

William Roeder  
Brian Lillard: Yea so ,what error is this that I can lookup? 

"Buy 0.07 at 1 [Invalid request]" Is one a valid price?

Brian Lillard  
William Roeder:

"Buy 0.07 at 1 [Invalid request]" Is one a valid price?

Ok -- it was something else

I had the Symbol string empty

Reason: