MT5/mql5 reported and confirmed bugs. - page 5

 
Dominik Christian Egert #:
The documentation says this:

Name of a custom indicator in the format of "indicator_name.ex5". Indicators that require testing are defined automatically from the call of the iCustom() function, if the corresponding parameter is set through a constant string. For all other cases (use of the IndicatorCreate() function or use of a non-constant string in the parameter that sets the indicator name) this property is required.

"For all other cases [...] this property is required."

How do I have to understand this?
You would use that property in an EA or Script, not in the indicator itself. It supposed to inform of the need for that indicator to also be included in the test of an EA when it is not identified by the normal means like calls to iCustom.
 
Ha. Ok.

So I cannot load the indicator recursively, feed it the data of the parent and have this been dynamically loading different types...

I see, it's not necessary, because the indicator is already in place....

Of course...

But still, this should not prevent the debugger from halting, should it?
 
Dominik Christian Egert #:
Ha. Ok.

So I cannot load the indicator recursively, feed it the data of the parent and have this been dynamically loading different types...

Sure you can load it recursively, it's not related to the topic.

I see, it's not necessary, because the indicator is already in place....


Of course...

But still, this should not prevent the debugger from halting, should it?
Probably not but honestly I don't care.
 
Deviation variable amount changes from 1.2 to 1.100000009 in bolinger band.
 
amrali #:

Bug in MQL string() function. Wrong conversion of double -> string

Build 3182 but this is not specific to this build, it's an old one.

A bug is found in string() function where wrong conversion of double -> string.

If you convert an arbitrary double-precision floating-point number to a decimal string, and then convert that back to floating-point, you should recover the original floating-point number. In other words, the conversion will round-trip.

The string() function may return wrong string representation of double numbers that cannot round-trip into the same numeric value.

This also affects any implicit cast inside Print(), Alert(), Comment(), FileWrite().

This a sample script to reproduce the bug:

Thank you for your report.

It will be fixed soon

 

Reported in 2019. Confirmed recently by @Anatoli Kazharski

Forum on trading, automated trading systems and testing trading strategies

New version of the MetaTrader 5 platform build 2007: Economic calendar, MQL5 programs as services

Alain Verleyen , 2019.04.16 03:50

Build 2007/2025.

It doesn't seem to be possible to change the "Accept" header in a WebRequest (it works with mql4).

The attached code should return a JSON response, like so:

{ "responseParameters": { "doui_setResponseParameters": [ "8AA8D0CD6A05153A016A16735AF94E0E"]}}

But the response is an HTML file because the server needs an "Accept: application/json" header. I know this because it works with Postman for example.

When inspecting HTTP sent by MT5 with Wireshark, the "Accept" header is always:

To accept: * / *

Is this a bug or am I missing something?

It was fixed from build 3295.
 
Ilyas #:

Thank you for your report.

It will be fixed soon

IMHO a "shortest" round-trip conversion needs to be considered.

Thanks.

 
Alain Verleyen #:

Build 3180 but this is not specific to this build, it's an old one.

On indicators, MT5 can set automatically a level "0" depending of the buffer values. There is no way to disable this behaviour or to customize the level line drawing.


Almost fixed in build 3191.
Custom Indicator showing ZERO level, though not defined anywhere in the code
Custom Indicator showing ZERO level, though not defined anywhere in the code
  • 2021.01.27
  • www.mql5.com
Custom Indicator showing ZERO level, though not defined anywhere in the code...
 
Ilyas #:

Thank you for your report.

It will be fixed soon

build 3194: string() function bug is fixed, finally.

I think this was done by adopting a brute force approach through trial of rounding to at most 17 significant decimal digits to guarantee round-tripping.

Finally, the output of double numbers from Print(), Alert(), Comment() and FileWrite() is much clear and less-confusing.

As a result, if the input number is rounded (or parsed from a human-typed decimal string), you will not see those extra decimal digits printed. In the case, there are many digits after the decimal point, it gives you a hint that the number is NOT rounded as expected, in the first place.

This 1:1 mapping will clear much of the confusion on the forum regarding printing (double->string conversion) of floating point numbers .

Thanks MetaQuotes.

Edit:

Now what you see is what you get.

void OnStart()
  {
   Print(0.3);
   Print(0.1 + 0.2);
  }
  
// Output:
// 0.3
// 0.30000000000000004
 
Bug in MQL NormalizeDouble() function. Round-off errors in the function output.

Build 3194 and all the previous builds.

A minor bug is encountered in NormalizeDouble() function where small round-off errors (= 1 ULP; unit in the last place) is frequently introduced in the function output.

These small roundoff errors will be much more noticed in the future, after MetaQuotes has fixed the code to print floating-point numbers accurately.

This a test script to reproduce the bug:

#property script_show_inputs
input int digits = 5; // Round numbers to specified digits

void OnStart()
  {
   int fails = 0;
   double dStart = 1e-6;
   double dEnd = 2.0;
   string filename = "roundoff.csv";

   int handle = FileOpen(filename, FILE_WRITE|FILE_SHARE_READ|FILE_CSV|FILE_ANSI,',');
   FileWrite(handle, "Rounded number", "NormalizeDouble() roundoff");

   double point = MathPow(10,-digits);
   double d1, d2;
   for(d1 = dStart; d1 < dEnd && !IsStopped(); d1+=point)
     {
      // Generate a number correctly rounded to specified digits.
      d1 = StringToDouble(DoubleToString(d1, digits));

      // Bug in NormalizeDouble() function. Round-off errors in the function output.
      d2 = NormalizeDouble(d1, digits);

      // If the original number cannot be recovered, this confirms the bug.
      if(d1 != d2)
        {
         FileWrite(handle, d1, d2);
         fails++;
        }
     }

   FileClose(handle);
   Execute(TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL5\\Files\\" + filename);
   printf("Build %d: NormalizeDouble() roundoff errors: %d", TerminalInfoInteger(TERMINAL_BUILD), fails);
  }

#import "shell32.dll"
int ShellExecuteW(int hWnd,string Verb,string File,string Parameter,string Path,int ShowCommand);
#import
void Execute(const string command,const string parameters="")
  {
   shell32::ShellExecuteW(0,"open",command,parameters,NULL,1);
  }
//+------------------------------------------------------------------+

// Sample output:
// Build 3194: NormalizeDouble() roundoff errors: 16636