NormalizeDouble in MT5 strategy tester

 

Hi MQL community,

I'm trying to normalize the bollinger band values into 5 digits from 6.

I tested using an alert and the value had been normalized correctly. However, when I run my EA in the strategy tester, it still shows 6 digits.

P.S. I have included a MQL4 to MQL5 converting file in the header.

Here is the test I ran:

Is this a known bug in the MT5 strategy tester?

Thanks, Tim

#property copyright "Copyright 2018, Tim Smith"
#property link      "https://www.mql5.com"
#property version   "1.00"

//#include <MT4orders.mqh>
#include <mql4compat.mqh>
//#include<mql4compat.mqh>
//#include <MT4Orders.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
  
double LowerBB= NormalizeDouble(iBandsMQL4(NULL,0,20,2,0,6,MODE_LOWER,0),5);
Alert(LowerBB);
  
  }
//+------------------------------------------------------------------+
 
https://www.mql5.com/en/docs/convert/doubletostring
Documentation on MQL5: Conversion Functions / DoubleToString
Documentation on MQL5: Conversion Functions / DoubleToString
  • www.mql5.com
value is in the range between 0 and 16, a string presentation of a number with the specified number of digits after the point will be obtained. If the value is in the range between -1 and -16, a string representation of...
 
timothysmith78: I'm trying to normalize the bollinger band values into 5 digits from 6. it still shows 6 digits.
  1. Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.)
              Double-precision floating-point format - Wikipedia, the free encyclopedia

    See also The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum

    Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.

  2. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is usually wrong, as it is in this case.

Reason: