Decimal Problem

Back to topics list To post a new topic, please log in or register
avatar
10
Barno_07 2016.07.06 11: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());
}         
avatar
13006
WHRoeder 2016.07.06 14: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
Back to topics list  

To add comments, please log in or register