mql4 stoploss by pips ?

 

hi,


this is my first program with mql4, and I thing I have every thing to write the code, but I don't know how to write the stop loss with with a number of pips, is it posible? and if so, how do I do that?


thanks

 
jsgaston:

hi,


this is my first program with mql4, and I thing I have every thing to write the code, but I don't know how to write the stop loss with with a number of pips, is it posible? and if so, how do I do that?


thanks


Here's an example

void OnStart()
{
   if(long_signal)
      if(MarketOrderBuy(lots,sl_points,tp_points,slippage_points) < 0)
         Print(__FUNCTION__," OrderSendError: ",GetLastError());
}


int MarketOrderBuy(double lots,int stop=0,int take=0,int slippage = 0)
{
   return OrderSend(_Symbol,OP_BUY,lots,Ask,slippage,Ask-stop*_Point,Ask+take*_Point);
}

int MarketOrderSell(double lots,int stop=0,int take=0,int slippage = 0)
{
   return OrderSend(_Symbol,OP_SELL,lots,Bid,slippage,Bid+stop*_Point,Bid-take*_Point);
}
 
nicholishen:

Here's an example


thank's nicholishen



Is there any whay to receave an alert when someone writes back a message in the fórum?

 
jsgaston:

thank's nicholishen



Is there any whay to receave an alert when someone writes back a message in the fórum?

This forum sucks about that. You can download the phone app and register your mq id to get phone alerts. Sometimes it works...
Reason: