Beta MetaTrader 4 Build 555 with Updated MQL4 Language and Market of Applications Released - page 12

 
autoabacus:

A forward slash in code excluded by conditional compilation crashes the compiler, which goes into an infinite loop requiring the process to be killed.

I like the enhancements to MT4 a lot, thank you, and want to use conditional compilation. Forward slashes in code to be excluded by conditional compilation are hardly unusual, so I hope this gets fixed soon.

I was able to reproduce the bug via the following simple bit of code:

// #define TRADING_BOT 0
void OnInit() {
#ifdef TRADING_BOT
int bug = 1234 / 2; // The division (single forward slash) crashes the compiler if the macro TRADING_BOT is not defined
string msg = "Up/Down (Green/Red) ..."; // Single forward slashes in quoted text will also cause the crash if excluded by conditional compilation. They are ok in comments.
#endif
}

That code snippet gave the crash with builds 562 and 563 running on Windows 7.

A workaround is to remove all '/'s from within code that might be excluded by conditional compilation by:

- using a macro for division e.g. #define DIV(a, b) ((a)/(b))

- reformulating text to avoid '/'s


This was corrected in MT4 build 565, Metaeditor build 882, though in the process a new bug was introduced: indented #ifdef #endif blocks cause spurious errors if being skipped via conditional compilation. I have reported the new bug to Service Desk.

Update: The indented conditional compilation blocks bug, and another conditional compilation bug re incorrect line numbers in errors message with skipped code, were corrected in build 566 issued 2013.12.24

 
please add economic new calender with it and modify the new. add expert analysis base on fundamental and technical. Thank you
 

MT4 build 566 broke the GUI Dialog and Control components.

  1. The CCombobox control is broken. It draws an empty listview on creation and then is unable to hide it and does not respond to selections in the listbox. This is probably due to the CListView control not working properly. The hide function does not work and neither does the select function.

  2. An EA using the dialog/control components will run once only after MT4 starts. On subsequent loads, it is immediately removed from the chart automatically. No errors reported in the journal.
    Indicators using the dialog/controls do not even run once. They are immediately removed from the chart automatically. No errors reported in the journal. (SimplePanel example code from the website).

    This is an old bug that has been reintroduced.

EDIT!

Regarding point 2, this happens when the EA/Indicator uses the CDialog/CAppDialog control.

Example of combobox in indicator that does not work correctly. (Point 1 above):

#property strict
#property indicator_chart_window
#include <Controls\ComboBox.mqh>

CComboBox *cbxExample;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {  
  cbxExample=new CComboBox;
  cbxExample.Create(0,"OrderCombo",0,10,100,110,120);
  cbxExample.AddItem("Item Nr 0",0);
  cbxExample.AddItem("Item Nr 1",1);
  cbxExample.AddItem("Item Nr 2",2);
  cbxExample.AddItem("Item Nr 3",3);
  cbxExample.AddItem("Item Nr 4",4);
  cbxExample.ListViewItems(5);
  cbxExample.Select(3);
  return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Deinitialization                                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
  delete cbxExample;
  return;
}

//+------------------------------------------------------------------+
//| 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) {
}
 

There is a conflict with the use of the keyword extern.

  1. It is used to define parameters in mql4 and this function remains.

  2. It is used to define variables of global scope in the new mql4(5) according to the documentation (mql4.chm) but it does not work as such. It still has the old mql4 function.
 
xaphod:

There is a conflict with the use of the keyword extern.

  1. It is used to define parameters in mql4 and this function remains.

  2. It is used to define variables of global scope in the new mql4(5) according to the documentation (mql4.chm) but it does not work as such. It still has the old mql4 function.

Thanks for your message. The issue will be fixed.
 

I was playing with examples in the Help file. This line always fails with runtime error ERR_SOME_OBJECT_ERROR (Graphical object error):

ObjectCreate(chart_ID,name,OBJ_CHART,sub_window,0,0);

I am not sure if the chart-in-chart feature is implemented.

 
For the same reason(s) as in MT5, MT4 needs an OrderSendAsync() function and thus OnTrade() event handler. It is surprising that there is no such functionality in MT4 for the years and years that it exists. A simple example: if one needs to close say 4 orders in the same instrument in a row, it may take 'ages' to get finished.. That's a lot of time :) The other very usefull thing would have been to be able to call MT4 (or MT5) functions directly from a DLL or external application..
 
2cent:
For the same reason(s) as in MT5, MT4 needs an OrderSendAsync() function and thus OnTrade() event handler. It is surprising that there is no such functionality in MT4 for the years and years that it exists. A simple example: if one needs to close say 4 orders in the same instrument in a row, it may take 'ages' to get finished.. That's a lot of time :) The other very usefull thing would have been to be able to call MT4 (or MT5) functions directly from a DLL or external application..

+1 for all requested features
 

I have another note about the editor. I know it is very simple, but there is a feature that slows me down a lot:

If using the method/member hints (by pressing ctrl+space), only direct members are listed, i.e. while object.<ctrl+space> lists all methods and members, then object.getAnotherObject().<ctrl+space> does not list any. In such case I have to search source files for the class definition (in addition, there is no direct hint what the class name is, so first step is to locate the function, next step to find the class).

 

A note about MT4/MT5 portability.

I did not find out, how I recognize which functions/keywords were not available in the MQL5 or had different use. In case I wish to port the MQL4 code to MT5 (which should be easy with the new editor/compiler), I would prefer to avoid the MQL4 specific keywords and features, if I could recognize them.

Reason: