Download MetaTrader 5
To add comments, please log in or register
Articles have already helped many traders. Come and read them!
Barno_07
36
Barno_07 2016.07.06 09:26 
I am a beginner learning to code an EA. well in my EA i m calculating a percentage of range of a candle in Hourly candles. But in calculation 1 extra decimal place arriving such as in WTI.oil my BSO is 49.64 but it is coming 49.645. How can i code to ignore the last decimal place and take 2 places after decimal.. Please help me..
void openbuystop()
{
  int a= ((High[1]-Low[1])*6*10/100);
  double t = (a*2);
   if (OrderSend(Symbol(),OP_BUYSTOP,lot,a+High[1],3,High[1],a+High[1]+t,NULL,magic,0,NULL)== true)
   {
      Alert("Order Sent");
   }
   else
   fun_err(GetLastError());
}         
whroeder1
13627
whroeder1 2016.07.06 12:51  
Barno_07: How can i code to ignore the last decimal place and take 2 places after decimal..
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
/
To add comments, please log in or register