Download MetaTrader 5

need an example of buy 1.8 LOT EURUSD SL 35 TP 70 pip comment kelly

To add comments, please log in or register
LEE Chun Wing
831
LEE Chun Wing  

need an example of buy 1.8 LOT  EURUSD

SL 35 pip

TP 70 pip

comment = kelly

 

thankyou 

LEE Chun Wing
831
LEE Chun Wing  

int SendRandomPendingOrder(long const magic_number)
  {
//--- prepare a request
   MqlTradeRequest request;
   request.action=TRADE_ACTION_PENDING;         // setting a pending order
   request.magic=magic_number;                  // ORDER_MAGIC
   request.symbol=_Symbol;                      // symbol
   request.volume=0.1;                          // volume in 0.1 lots
   request.sl=0;                                // Stop Loss is not specified
   request.tp=0;                                // Take Profit is not specified
   request.deviation=5;                         // deviation in 5 points        


//--- form the order type
   request.type=GetRandomType();                // order type


//--- form the price for the pending order
   request.price=GetRandomPrice(request.type);  // open price


//--- send a trade request
   MqlTradeResult result;
   OrderSend(request,result);


//--- write the server reply to log  
   Print(__FUNCTION__,":",result.comment);
   if(result.retcode==10016) Print(result.bid,result.ask,result.price);


//--- return code of the trade server reply
   return result.retcode;
  }

To add comments, please log in or register