Latest MT4 update 1421 has a very SERIOUS BUG!!!

 

Hello Developer Team,

I found a very serious bug in latest MT4 update (version 4.00 build 1421 on 22 Jul 2024). It's MathRound() function always give result 0, which is incorrect.

I tried to make a simple script just to print out the result of MathRound(1.23) or any double value, it always give result 0, which should be 1 (check the attached screenshots).

This malfunction is a serious bug and destroy many EAs' logics. Please fix it as soon as possible. It's URGENT!!!

Thanks and best regards,




Files:
Untitled-4.jpg  77 kb
Untitled-5.jpg  30 kb
Untitled-6.jpg  58 kb
 
I will move your thread to MT4 section of the forum.
 
Could you give us more details about your PC

your CPU
your OS

is it Virtual Machine?
 
I have a server 2022..(vps)

It can't calculate correct lotsize

Its works perfectly on win11..(my own pc)

And its only 1421...
1420 works 
 
CPU?
 
Ilyas #:
CPU?
I'll look in a minute.


Look like its the same
 

here is info on 3 computeres, win10 win11 and a server....


MetaTrader 4 - version 4.00 -  build 1421

script value 1.23 return


Processor  13th Gen Intel(R) Core(TM) i5-13600KF   3.50 GHz

Installeret RAM  32,0 GB (31,8 GB kan bruges)

Systemtype  64-bit operativsystem, x64-baseret processor

Udgave  Windows 11 Pro

Version  23H2

Installeret d.  ‎04-‎10-‎2023

Operativsystemets build  22631.3958

Visning  Windows Feature Experience Pack 1000.22700.1026.0



MetaTrader 4 - version 4.00 -  build 1421

script value 1.23 return


Processor  Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz   3.60 GHz

Installeret RAM  32,0 GB

Systemtype  64-bit operativsystem, x64-baseret processor

Udgave  Windows 10 Pro

Version  22H2

Installeret d.  ‎19-‎02-‎2021

Operativsystemets build  19045.4651

Visning  Windows Feature Experience Pack 1000.19060.1000.0


NOT WORKING

MetaTrader 4 - version 4.00 -  build 1421

script value 0.01 return


Processor  QEMU Virtual CPU version 2.5+   2.39 GHz  (2 processors)

Installed RAM  3.00 GB

System type  64-bit operating system, x64-based processor

Edition  Windows Server 2022 Datacenter

Version  21H2

Installed on  ‎11/‎25/‎2023

OS build  20348.2113





//+------------------------------------------------------------------+
//|                                    build_test_math_functions.mq4 |
//|                                 Copyright 2024, Carl-Emil Bograd |
//|                         https://www.instagram.com/carlemilbograd |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Carl-Emil Bograd"
#property link      "https://www.instagram.com/carlemilbograd"
#property version   "1.00"
#property strict

input double input_variable = 1.23;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  double lotsize = input_variable;
  
   lotsize = MathRound(lotsize / MarketInfo(Symbol(), MODE_LOTSTEP)) * MarketInfo(Symbol(), MODE_LOTSTEP);
   lotsize = MathMax(MarketInfo(Symbol(), MODE_MINLOT), MathMin(MarketInfo(Symbol(), MODE_MAXLOT), lotsize));

   Alert((string)lotsize);
   
   return(INIT_SUCCEEDED);
  }
  
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
 

could you create DLL with next exported function and try it to call from MQL program on QEMU virtual PC?

C++

//+------------------------------------------------------------------+
//|                                                         test.dll |
//|                                  Copyright 2024, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#include <windows.h>
#include <math.h>

extern "C" double __declspec(dllexport) fround(double val)
  {
   return(val<0 ? ceil(val-0.5) : floor(val+0.5));
  }

DWORD __stdcall DllMain(void*,UINT,void*)
  {
   return(1);
  }
//+------------------------------------------------------------------+


MQL4:

#import "test.dll"
double fround(double x);
#import

void OnStart()
  {
   Print(fround(1.23));
  }


What will print it out?

You can use my test.dll if you trust

Files:
test.zip  5 kb
 
Ilyas #:

could you create DLL with next exported function and try it to call from MQL program on QEMU virtual PC?

C++


MQL4:


What will print it out?

You can use my test.dll if you trust


Same problem
https://www.mql5.com/en/forum/470634/unread#unread 
 
Ilyas #:

could you create DLL with next exported function and try it to call from MQL program on QEMU virtual PC?

C++


MQL4:


What will print it out?

You can use my test.dll if you trust

I'm the one Mikkelsen is talking for, I'll take over from here so that he's not a "middle-man"

I can't seem to get your code to work.
I placed the test.dll inside the MQL4\Libraries folder, and created a script based on your code:

#import "test.dll"
double fround(double x);
#import

void OnStart()
  {
   Print(fround(1.23));
  }

I get an error like this:

Cannot call 'test.dll::fround', 'test.dll' is not loaded

Please advise, we want to cooperate in hopefully fixing the issue at hand.

 
Ilyas #:

Did you copy test.dll into the <data>\MQL5\Libraries folder?

I did not.
Would I need to?

The issue is with MT4 build 1421, so I didn't think I would need to put the test.dll into the MQL5 library folder.
I did however, as stated put it into MQL4 library folder!