Percentage of a candle

Back to topics list To post a new topic, please log in or register
avatar
10
Barno_07 2016.05.31 15: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());
}
avatar
2017
gooly 2016.05.31 16:10 #
 

Do you know what char means?

Just place you cursor above it and press F1.

You'd better use double.

avatar
10
Barno_07 2016.05.31 16:26 #
 

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

 

avatar
10
Barno_07 2016.05.31 16: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?
avatar
2017
gooly 2016.05.31 18: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)


Back to topics list  

To add comments, please log in or register