New version of the MetaTrader 4 Platform build 1350

 

The MetaTrader 4 platform update will be released on Thursday, October 14, 2021. This version provides error fixes and platform stability improvements.

The update will be available through the Live Update system.

 

I updated MT4 instances to build 1350:

 

the date of metaeditor is wrong

 
Enau #:

the date of metaeditor is wrong

It's not.
 

I reported this bug last time, but I finally figured out what causes it, so I'm here to report it again.

Issue: For a channel, calling ObjectGetValueByTime with line_id=1 returns an incorrect value if you check the object type beforehand using ObjectGetInteger instead of ObjectType.

I hope you guys look into it because there's no way to call ObjectGetValueByTime on multi-line object in another chart if you need to check the object type.

Here's the code, I left a comment for you to alternate between the commented and uncommented lines to check for yourselves.

To test it, just create an Equidistant Channel, select it, then move it around. It will make a Comment displaying the price. You'll see that the bug displays a wrong value.

#property strict
#property indicator_chart_window

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
  return (INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {

  return (rates_total);                
}
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam) {
  CheckBoundary();
}

void CheckBoundary() {
  for (int i = ObjectsTotal() - 1; i >= 0; i--) {
    const string name = ObjectName(i);
    
    //--- Alternate between these two lines to see the bug
    const long type   = BuggedType(name);
    //const int type    = WorkingType(name);
    
    //--- Uncomment any of these lines to break WorkingType
    //const string name1   = ObjectGetString(0, name, OBJPROP_NAME);
    //ObjectSetString(0, name, OBJPROP_TEXT, "Hello World");

    if (type == OBJ_CHANNEL) {
      const double price  = ObjectGetValueByTime(0, name, Time[0], 1);
      
      Comment("Price: ", DoubleToStr(price, Digits));
    }
  }
}

int WorkingType(const string obj_name) {
  return ObjectType(obj_name);
}

long BuggedType(const string obj_name, const long chart_id=0) {
  return ObjectGetInteger(chart_id, obj_name, OBJPROP_TYPE);
}
 

UPDATE

I was still experiencing issues with ObjectGetValueByTime even after discovering the issue and calling ObjectType directly.

After some debugging, I figured out that calling ObjectGetString or ObjectSetString, before calling ObjectGetValueByTime, will also cause the issue, even if you use ObjectType.

I updated my code above to include the lines that will break WorkingType. Uncomment any of them to reproduce the issue.

BTW, does anyone if the devs read this thread for bug reports? I think they read the Russian threads, but I'm not sure if they read the English threads.

 
Alexander Martinez #: BTW, does anyone if the devs read this thread for bug reports? I think they read the Russian threads, but I'm not sure if they read the English threads.

You post on the post for your terminal version, e.g. 1350 (this one). Don't forget to include a code example to reproduce the issue.

Or in the Russian thread //www.mql5.com/ru/forum/347385 so the developers will look on to it (with some elaboration, or codes to reproduce the bug, and may be more). -

 
William Roeder #:

You post on the post for your terminal version, e.g. 1350 (this one). Don't forget to include a code example to reproduce the issue.

Or in the Russian thread //www.mql5.com/ru/forum/347385 so the developers will look on to it (with some elaboration, or codes to reproduce the bug, and may be more). -

Thank you. I'll post on the Russian thread to be safe.

 
 OK :D it was feature request for CHARTEVENT_GLOBALVARIABLES_CHANGE
Event Handling Functions - Functions - Language Basics - MQL4 Reference
Event Handling Functions - Functions - Language Basics - MQL4 Reference
  • docs.mql4.com
Event Handling Functions - Functions - Language Basics - MQL4 Reference
 

Other problems..

The windows for instruments ctr+B have col "Window" but for each window is always ID = 0, no sense (can recognize window ID).

Time set for Global Vars need milliseconds.

 

Hi


I've noticed that HTTP error code descriptions are missing from included ErrorDescription function in library file stdlib.mq4 :


      case 5200: error_string="Invalid URL";                                               break;
      case 5201: error_string="Failed to connect to specified URL";                        break;
      case 5202: error_string="Timeout exceeded";                                          break;
      case 5203: error_string="HTTP request failed";                                       break;


https://docs.mql4.com/constants/errorswarnings/errorcodes

Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL4 Reference
Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL4 Reference
Reason: