Download MetaTrader 5
To add comments, please log in or register
Order the development and track its status via your mobile phone.
Barno_07
36
Barno_07 2016.05.31 13:37 
Hey there I want to calculate the % out of the range of a candle. and on the basis of that I want my EA to place orders on the next candle. but it's not working. please tell me where i have done wrong.
void openbuystop()
{
  char a=  (High[1]-Low[1])*0.04;
   if (OrderSend(Symbol(),OP_BUYSTOP,lot,a*Point+High[1],3,High[1],a*Point+High[1]+tp*Point,NULL,magic,0,NULL)== true)
   {
      Alert("Order Sent");
   }
   else
   fun_err(GetLastError());
}

void opensellstop()
{
  char b =  (High[1]-Low[1])*0.04;
    if (OrderSend(Symbol(),OP_SELLSTOP,lot,Low[1]-b*Point,3,Low[1],Low[1]-b*Point-tp*Point,NULL,magic,0,NULL)== true)
   {
      Alert("Order Sent");
   }
   else
   fun_err(GetLastError());
}
Carl Schreiber
5940
Carl Schreiber 2016.05.31 14:10  

Do you know what char means?

Just place you cursor above it and press F1.

You'd better use double.

Barno_07
36
Barno_07 2016.05.31 14:26  

Sorry. It was previously done. I have tried using double. But then also it is not working.

Barno_07
36
Barno_07 2016.05.31 14:39  
gooly:

Do you know what char means?

Just place you cursor above it and press F1.

You'd better use double.

Can you help in these please?
Carl Schreiber
5940
Carl Schreiber 2016.05.31 16:12  

no need to multiply with Point!!

double a =  (High[1]-Low[1])*0.04; // a is already in Points
if (OrderSend(Symbol(),OP_BUYSTOP,lot,a+High[1],3,High[1],a+High[1]+tp*Point,NULL,magic,0,NULL)== true)
/
To add comments, please log in or register