A month ago, Microsoft released a major update of their operating system Windows 10 Creators Update (version 1703). After installing this update, some users were unable to run MQL4 programs in their terminals. This issue has been fixed in the new MetaTrader 4 platform build 1080. Now, Expert Advisors and indicators will run on charts correctly, while recompilation using the updated MetaEditor is not required.
Support for MetaTrader 4 client terminal versions below 1065 will be discontinued on the 1st of October 2017. Unsupported terminal builds will not be able to connect to new server versions. We strongly recommend that you update your terminals in advance.
In the new version, an error has been fixed connected with the restart of Expert Advisors on charts after switching timeframes. Now, Expert Advisors do not stop, and are correctly re-initialized.
The release of MetaTrader 4 platform is connected with the release of Windows 10 Insider Preview build 15007. Due to security updates in the new Windows 10 system version, MetaTrader 4 client terminals could occasionally fail to start.
Install the new platform version in order to prepare for the upcoming Windows 10 update.
Added chat enabling traders to chat with other
MQL5.community members. Specify the desired user's login in a message
recipient's section to send a message directly to this user's mobile
device.
class CFoo { }; class CBar { }; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { void *vptr[2]; vptr[0]=new CFoo(); vptr[1]=new CBar(); //--- for(int i=0;i<ArraySize(vptr);i++) { if(dynamic_cast<CFoo *>(vptr[i])!=NULL) Print("CFoo * object at index ",i); if(dynamic_cast<CBar *>(vptr[i])!=NULL) Print("CBar * object at index ",i); } CFoo *fptr=vptr[1]; // Will return an error while casting pointers, vptr[1] is not an object of CFoo } //+------------------------------------------------------------------+
string text="Hello"; ushort symb=text[0]; // Will return the code of symbol 'H'
Fixed errors reported in crash logs.
class CAnimal { public: CAnimal(); // Constructor virtual void Sound() = 0; // A pure virtual function private: double m_legs_count; // How many feet the animal has };Here Sound() is a pure virtual function, because it is declared with the specifier of the pure virtual function PURE (=0).
class CAnimal { public: virtual void Sound()=NULL; // PURE method, should be overridden in the derived class, CAnimal is now abstract and cannot be created }; //--- Derived from an abstract class class CCat : public CAnimal { public: virtual void Sound() { Print("Myau"); } // PURE is overridden, CCat is not abstract and can be created }; //--- examples of wrong use new CAnimal; // Error of 'CAnimal' - the compiler returns the "cannot instantiate abstract class" error CAnimal some_animal; // Error of 'CAnimal' - the compiler returns the "cannot instantiate abstract class" error //--- examples of correct use new CCat; // no error - the CCat class is not abstract CCat cat; // no error - the CCat class is not abstractRestrictions on abstract classes
//+------------------------------------------------------------------+ //| An abstract base class | //+------------------------------------------------------------------+ class CAnimal { public: //--- a pure virtual function virtual void Sound(void)=NULL; //--- function void CallSound(void) { Sound(); } //--- constructor CAnimal() { //--- an explicit call of the virtual method Sound(); //--- an implicit call (using a third function) CallSound(); //--- a constructor and/or destructor always calls its own functions, //--- even if they are virtual and overridden by a called function in a derived class //--- if the called function is purely virtual //--- the call causes the "pure virtual function call" critical execution error } };However, constructors and destructors for abstract classes can call other member functions.
typedef int (*TFunc)(int,int);Now, TFunc is a type, and it is possible to declare the variable pointer to the function:
TFunc func_ptr;The func_ptr variable may store the pointer to function to declare it later:
int sub(int x,int y) { return(x-y); } int add(int x,int y) { return(x+y); } int neg(int x) { return(~x); } func_ptr=sub; Print(func_ptr(10,5)); func_ptr=add; Print(func_ptr(10,5)); func_ptr=neg; // error: neg is not of int (int,int) type Print(func_ptr(10)); // error: there should be two parametersPointers to functions can be stored and passed as parameters. You cannot get a pointer to a non-static class method.
Fixed errors reported in crash logs.
Now, you can set a PIN code to access the application. This will provide additional protection for your accounts even if you lose your mobile device. Enable "Lock Screen" in the application settings. By default, the PIN code is similar to the one used to access the one-time password generator.
Also, the new version includes multiple improvements and fixes.
The new version of the MetaTrader 4 web platform features the full set of indicators for technical analysis. The web platform now contains 30 most popular technical analysis tools featured by the MetaTrader 4 desktop version:
Accelerator Oscillator |
DeMarker | Moving Average |
Accumulation/Distribution | Envelopes | Moving Average of Oscillator |
Alligator | Force Index |
On Balance Volume |
Average Directional Movement Index | Fractals | Parabolic SAR |
Average True Range |
Gator Oscillator | Relative Strength Index |
Awesome Oscillator | Ichimoku Kinko Hyo | Relative Vigor Index |
Bears Power |
MACD | Standard Deviation |
Bollinger Bands |
Market Facilitation Index |
Stochastic Oscillator |
Bulls Power |
Momentum | Volumes |
Commodity Channel Index |
Money Flow Index | Williams' Percent Range |
The web platform interface is now available in 38 languages. 14 new languages have recently been added:
Dutch |
Lithuanian | Croatian |
Greek | Romanian | Czech |
Hebrew | Serbian |
Swedish |
Italian | Slovenian |
Estonian |
Latvian |
Finnish | |
Launch the web platform right now to test the new functionality!
The new version of the MetaTrader 4 Web Platform features faster chart performance, which is provided by the use of the new WebGL technology — now even with multiple running indicators, the web platform maintains optimal performance.
The web platform now features technical indicators. The following Bill Williams' indicators have already been added:
Added a link to the tutorial video "How to assemble a trading robot" to the MQL4 Wizard. Watch the three-minute video and develop a trading robot without writing a single line of code.
Fixed errors reported in crash logs.
//+------------------------------------------------------------------+ //| TemplTest.mq5 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Declare a template class | //+------------------------------------------------------------------+ template<typename T> class TArray { protected: T m_data[]; public: bool Append(T item) { int new_size=ArraySize(m_data)+1; int reserve =(new_size/2+15)&~15; //--- if(ArrayResize(m_data,new_size,reserve)!=new_size) return(false); //--- m_data[new_size-1]=item; return(true); } T operator[](int index) { static T invalid_index; //--- if(index<0 || index>=ArraySize(m_data)) return(invalid_index); //--- return(m_data[index]); } }; //+------------------------------------------------------------------+ //| Template class of a pointer array. In the destructor, it deletes | //| the objects, the pointers to which were stored in the array. | //| | //| Please note the inheritance from the TArray template class | //+------------------------------------------------------------------+ template<typename T> class TArrayPtr : public TArray<T *> { public: void ~TArrayPtr() { for(int n=0,count=ArraySize(m_data);n<count;n++) if(CheckPointer(m_data[n])==POINTER_DYNAMIC) delete m_data[n]; } }; //+------------------------------------------------------------------------+ //| Declare the class. Pointers to its objects will be stored in the array | //+------------------------------------------------------------------------+ class CFoo { int m_x; public: CFoo(int x):m_x(x) { } int X(void) const { return(m_x); } }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ TArray<int> ExtIntArray; // instantiate TArray template (specialize TArray template by the int type) TArray<double> ExtDblArray; // instantiate TArray template (specialize TArray template by the double type) TArrayPtr<CFoo> ExtPtrArray; // instantiate TArrayPtr template (specialize TArrayPtr template by the CFoo type) //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- fill arrays with data for(int i=0;i<10;i++) { int integer=i+10; ExtIntArray.Append(integer); double dbl=i+20.0; ExtDblArray.Append(dbl); CFoo *ptr=new CFoo(i+30); ExtPtrArray.Append(ptr); } //--- output the array contents string str="Int:"; for(i=0;i<10;i++) str+=" "+(string)ExtIntArray[i]; Print(str); str="Dbl:"; for(i=0;i<10;i++) str+=" "+DoubleToString(ExtDblArray[i],1); Print(str); str="Ptr:"; for(i=0;i<10;i++) str+=" "+(string)ExtPtrArray[i].X(); Print(str); //--- CFoo objects created via new should not be deleted, since they are deleted in the TArrayPtr<CFoo> object destructor }Execution result: