//+------------------------------------------------------------------+ //| MacroExample | //| Copyright 2014, MetaQuotes Software Corp. | //| https://www.metaquotes.net | //+------------------------------------------------------------------+ #property script_show_inputs input bool InpSecond=true; #define DEFCLASS(class_name) class class_name:public CBase{public:class_name(string name):CBase(name){}}; #define TOSTR(x) #x #define AUTODEL(obj) CAutoDelete auto_##obj(obj) #define NEWOBJ(type,ptr) do { ptr=new type(TOSTR(ptr)); \ Print("Create object '",TOSTR(type)," ",TOSTR(ptr),"' by macro NEWOBJ"); } \ while(0) //+------------------------------------------------------------------+ //| The basic class required for automatic deletion of objects | //+------------------------------------------------------------------+ class CBase { protected: string m_name; public: CBase(string name):m_name(name) { } string Name(void) const{ return(m_name); } }; //+------------------------------------------------------------------+ //| The object auto-delete class makes watching of created | //| objects unnecessary. It deletes them in its destructor | //+------------------------------------------------------------------+ class CAutoDelete { CBase *m_obj; public: CAutoDelete(CBase *obj):m_obj(obj) { } ~CAutoDelete() { if(CheckPointer(m_obj)==POINTER_DYNAMIC) { Print("Delete object '",m_obj.Name(),"' by CAutoDelete class"); delete m_obj; } } }; //+------------------------------------------------------------------+ //| Declaring two new classes CFoo and CBar | //+------------------------------------------------------------------+ DEFCLASS(CFoo); DEFCLASS(CBar); //+------------------------------------------------------------------+ //| The main script function | //+------------------------------------------------------------------+ void OnStart() { CFoo *foo; //--- Creating an object of the CFoo class NEWOBJ(CFoo,foo); //--- Creating an instance of the CFoo foo object auto-deletion class AUTODEL(foo); //--- if(InpSecond) { CBar *bar; //--- NEWOBJ(CBar,bar); AUTODEL(bar); } //--- No need to delete foo, it will be deleted automatically } //+------------------------------------------------------------------+
Fixed errors reported in crash logs.
Documentation has been updated.
Fixed errors reported in crash logs.
Updated documentation.
The update is available through the LiveUpdate system.
The money transfer option should be enabled on the trade
server. Depending on the settings, there are some restrictions on the
accounts, between which transfer is allowed. In particular, money
transfer can be allowed only for accounts with identical names and
emails.
Fixed display of the Label and Bitmap Label graphical objects with the anchor point located in one of the bottom corners of a chart.
int CryptEncode(ENUM_CRYPT_METHOD method,const uchar &data[],const uchar &key[],uchar &result[]); int CryptDecode(ENUM_CRYPT_METHOD method,const uchar &data[],const uchar &key[],uchar &result[]);A new enumeration ENUM_CRYPT_METHOD has been added for working with the functions:
CRYPT_BASE64, // BASE64 encryption (re-encoding) CRYPT_AES128, // AES encryption with 128-bit key CRYPT_AES256, // AES encryption with 256-bit key CRYPT_DES, // DES encryption (key length is 56 bits - 7 bytes) CRYPT_HASH_SHA1, // calculation of HASH SHA1 CRYPT_HASH_SHA256, // calculation of HASH SHA256 CRYPT_HASH_MD5, // calculation of HASH MD5 CRYPT_ARCH_ZIP, // ZIP archive
Fixed errors reported in crash logs.
Updated documentation.
The update will be available through the LiveUpdate system.
ご自身のiOS版MetaTrader 5のアップデートをお忘れなく。
Fixed errors reported in crash logs.
Updated documentation.The update will be available through the LiveUpdate system.
Market: Added new product category in MetaTrader AppStore — Magazines. Now, users can buy not only trading applications but also trading and financial magazines quickly and easily.
Just like MetaTrader 5 applications, magazines can be purchased at MQL5.community Market as well as directly via MetaTrader 5 terminal. All magazines are accompanied by detailed descriptions and screenshot galleries:
The latest magazine issues are always displayed in the showcase, while the previous ones can be found on the Archive tab.
To buy a magazine, you should have an MQL5.com account and the necessary amount of funds on it. The account data should be specified at the Community tab of the terminal settings:
Click Buy on the magazine's page to purchase it. Purchase confirmation dialog appears:
To continue, agree to the rules of using the Market service and enter your MQL5.community password. After that, the specified amount of funds will be withdrawn from your account and the magazine will be downloaded. Buy button will be replaced by Open one.
Magazine files are downloaded to My Documents\MQL5 Market\Magazines\[Magazine name]\[Issue name]. The download may be performed in two formats:
MQB - this protected format is used for paid magazines. When purchasing and downloading a magazine file, it is encoded so that it can be opened only on the PC it has been downloaded to. Generation of an encoded copy is called activation. Each magazine can be activated at least 5 times on different hardware. Magazine sellers can increase the number of activations at their sole discretion.
PDF - this format is used for free magazines. After downloading, such file can be moved and viewed on other devices.
The special component called MetaViewer has been added to MetaTrader 5 terminal allowing users to view MQB files. This application is launched when you click Open at the downloaded magazine page. If User Account Control system is enabled on the user's PC, the user will be prompted to allow the terminal to associate MQB files with MetaViewer during the first launch. After the association, MQB files are automatically opened in MetaViewer when launched from Windows file explorer.
If you click ÎÊ, the files are associated and the selected magazine issue is opened in MetaViewer immediately. If you click Cancel, only the magazine issue is opened.
MetaViewer is a convenient application for viewing books and magazines in MQB and PDF formats. Keyboard arrows are used to turn over the pages: left and right arrows - for page-by-page navigation, while up and down arrows - for scrolling. MetaViewer menu and control panel contain additional commands for setting the journal's view and navigation:
Terminal: Added MQL tab to EX5 file properties. The tab contains the program's icon as well as its name and description specified in the application's source code via the appropriate #property parameters.
The tab appears only after MetaViewer is registered in the system. If a current user has sufficient rights and User Account Control system is disabled, MetaViewer is registered automatically during the terminal's first launch after the update. Otherwise, the user will see the dialog window requesting a one-time elevation of rights for MetaViewer during the first attempt to open a magazine.
Terminal: Added MQL5.community fast registration dialog in case a user has no account. Now, an MQL5.community account can be created without the need to leave the terminal.
Specify login and email address in the registration window. After clicking Register, an email for MQL5.community account activation is sent to the specified address.
MQL5.community account allows traders to use additional powerful services:
Terminal: Added information about margin charging rates for various order types, as well as the list of spreads that may include orders and positions for the symbol, to the trading symbol data dialog.
Margin Rates:
A multiplier for calculating margin requirements relative to the margin's main amount is specified for each order type. The main amount of margin is calculated depending on the specified calculation method (Forex, Futures, etc.).
Calculation of margin requirements is described in details in the client terminal user guide.
Spreads:
The margin can be charged on preferential basis in case trading positions are in spread relative to each other. The spread is defined as the presence of the oppositely directed positions at related symbols. Reduced margin requirements provide traders with more trading opportunities.
The spread has two legs - A and B. The legs are the oppositely directed positions in a spread - buy or sell. The leg type is not connected with some definite position direction (buy or sell). It is important that trader's positions at all leg's symbols are either long or short.
Several symbols with their own volume rates can be set for each spread leg. These rates are shown in parentheses, for example, LKOH-3.13 (1).
Take a look at the following example:
To keep positions in the spread, a trader should open positions of 1 and 2 lots for GAZR-9.12 and GAZR-3.13 respectively in one direction and a position of 1 lot for GAZR-6.13 in another.
Margin column displays margin charging type at this spread:
Specific values mean charging a fixed margin for a spread in a specified volume. The first value specifies the volume of the initial margin, while the second one specifies the volume of the maintenance one.
Maximal - initial and maintenance margin values are calculated for each spread leg. The calculation is performed by summing up the margin requirements for all leg symbols. The margin requirements of the leg having a greater value will be used for the spread.
CME Inter Spread - the rates (in percentage value) for margin are specified: the first one is for the initial margin, while the second is for the maintenance one. The total margin value will be defined by summing up the margin requirements for all symbols of the spread and multiplying the total value by the specified rate.
CME Intra Spread - two values for margin increase are specified: the first value is for the initial margin, while the second is for the maintenance one. During the calculation, the difference between the total margin of A leg symbols and the total margin of B leg symbols is calculated (the difference in absolute magnitude is used, so that it does not matter what leg is a deductible one). According to the type of the calculated margin, the first (for the initial margin) or the second (for the maintenance one) value is added to the obtained difference.
The specified margin is charged per spread unit - for the specified combination of positions. If any part of the position does not fit the spread, it will be charged by an additional margin according to the symbol settings. If the client's current positions have the volume the specified combination fits in several times, the charged margin is increased appropriately. For example, suppose that A and B symbols with the ratios of 1 and 2 are in spread. If a client has positions for these symbols with the volumes of 3 and 4 respectively, the total margin size is equal to the doubled value from the spread settings (two spreads: 1 lot of A and 2 lots of B, 1 lot of A and 2 lots of B) plus the margin for the single remaining A symbol lot.
Spreads are described in details in the client terminal user guide.
Market: Added product activation confirmation dialog displaying the number of remaining activations.
Each application purchased in MetaTrader AppStore is additionally protected, so that it can be launched only on the PC it has been downloaded to during the purchase. Generation of an encoded copy is called activation. Each product can be activated at least 5 times on different hardware. Sellers can increase the number of activations at their sole discretion.
The new dialog protects users from wasting activations by informing that their number is limited.
Signals: Added information about a signal, to which an account is subscribed, to the Navigator window:
If the account is subscribed to the signal, the appropriate icon with the signal's name is shown for it. When hovering the mouse cursor over the name, the subscription's expiration date is displayed. The context menu contains commands for viewing the signal and unsubscribing from it. The latter one is displayed only if the appropriate trading account is currently active in the terminal.
The subscription icon makes working with signals more convenient.
Signals: Added legend for equity, growth, balance and distribution graphs. Also, marks displaying funds depositing and withdrawal have been added to the equity graph. When hovering the mouse cursor over the balance operation triangle, a tooltip with the operation sum is displayed:
The time is displayed up to milliseconds in the client terminal's, MetaEditor's and MetaTester's Journal.
Improved scanning and searching for servers in demo account opening dialog - scanning speed has been increased and additional search for access points for the servers having no connection has been added.
Added __MQL4BUILD__ and __MQL5BUILD__ macros - MQL5 compiler versions in MetaTrader 4 and MetaTrader 5 client terminals respectively. These macros can be used for displaying information about the compiler version used for compiling EX4\EX5 file in Experts log of the client terminal:
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Print(__FILE__," compiled with ",__MQL5BUILD__," build"); //--- return(INIT_SUCCEEDED); }
Fixed signals copying when performing balance and credit operations on the subscriber's account. The total amount of client's funds is changed after a balance/credit operation is performed. If the percentage value of signals copying has decreased by more than 1% afterwards (the volume of copied trades is calculated considering the ratio of the subscriber's and provider's balance), the subscriber's account is forcedly synchronized with the provider's one. This is done to correct the subscriber's current positions according to the new copying percentage value.
If the subscriber's funds have increased due to the balance or credit operation, no forced synchronization is performed.
Fixed errors reported in crash logs.
Updated documentation.
The live update is available through the LiveUpdate system.
The MetaTrader 5 Trading Terminal can be downloaded at https://download.mql5.com/cdn/web/metaquotes.ltd/mt5/mt5setup.exe?utm_source=www.metatrader5.com
ご自身のiOS版MetaTrader 5のアップデートをお忘れなく。そして、ぜひモバイルプラットフォームの新しい機能をご体験ください。
Fixed errors reported in crash logs.
Updated documentation.
The live update is available through the LiveUpdate system.
The MetaTrader 5 Trading Terminal can be downloaded at https://download.mql5.com/cdn/web/metaquotes.ltd/mt5/mt5setup.exe?utm_source=www.metatrader5.com
Added the option for unconditional synchronization of positions between a signal source and a subscriber's account. If enabled, synchronization of positions (including closing open positions not related to the signal) during the initial synchronization of the subscriber's and signal source's state is performed without additional confirmation.
Thisption is necessary when using signals on VPS (Virtual Private Server). It can also be used to increase the synchronization reliability when working with the already selected signal.
Fixed errors reported in crash logs.
Updated documentation.
The live update is available through the LiveUpdate system.
The MetaTrader 5 Trading Terminal can be downloaded at https://download.mql5.com/cdn/web/metaquotes.ltd/mt5/mt5setup.exe?utm_source=www.metatrader5.com
Added ability to send push notifications of transactions occurring on the client account: placing, changing and removing orders and deals, activation of pending orders and SL-TP, margin call and stop-out events.
Added display and managing alerts from the chart.
When management of trading levels from the chart is allowed, alert's price value can be changed by its dragging to a new price level. Alerts can be disabled or removed using a context menu of the appropriate level on the chart.
int a[2][2]={0,1,2,3};
Previously, the following entry has been necessary
int a[2][2]={{0,1},{2,3}};
Standard Library. Added CFlameCanvas class ("Include\Canvas\FlameCanvas.mqh") and an example of its application called Flame Chart ("Indicators\Examples\Canvas\FlameChart.mq5") - this example demonstrates the possibilities of generating custom images on the chart by means of MQL5.
The works on using the single compiler and MQL5 IDE for MetaTrader 4 and MetaTrader 5 are underway:
MQL5 on MetaTrader 4 and MetaTrader 5
Instead of working on MQL4 -> MQL5 compatibility, we have decided to go the opposite way. We have transferred the maximum possible amount of MQL5 language functions and features fully preserving MQL4 functionality. In other words, all powerful MQL5 functions, including ООP and the native code compiler, will become available in MQL4. To achieve this, we have developed a unified compiler that automatically supports both MQL4 and MQL5 languages. MetaEditor will also become a unified application both for MetaTrader 4 and MetaTrader 5 platforms. Thus, it will be possible to compile both MQL4 and MQL5 from any version.
MQL5 Storage with MetaTrader 4
It will be easier for developers to manage source code versions, participate in team operations and synchronize files.
Improving the security of application codes in MetaTrader 4
New EX4/EX5 files are provided with a serious and completely revised protection, as compared to the old EX4.
Market of MetaTrader 4 applications
Transition to the new compiler that supports resources and conventional protection suited for each user's PC will allow users to develop and sell full-fledged applications. There is no need to worry about the protection of EX4/EX5 files sold via the Market - they do not contain bytecode but only a pure native code signed by our private key. This solution puts in order all the diversity of existing programs and protects the sellers.
Fixed errors reported in crash logs.
Updated documentation.
The live update is available through the LiveUpdate system.
The MetaTrader 5 Trading Terminal can be downloaded at https://download.mql5.com/cdn/web/metaquotes.ltd/mt5/mt5setup.exe?utm_source=www.metatrader5.com
We have expanded MQL5.community payment system options by adding QIWI Wallet as a new way to deposit funds to your account.
This is already the fourth method of depositing money: now, you can use Visa QIWI Wallet along with WebMoney, PayPal and bank cards. Payment is made in rubles, charged commission is 1%, minimum payment is 100 rubles.
To deposit funds to your account, go to Payments section of your MQL5.com profile, select "Deposit to account" and choose QIWI Wallet from the four available options.
On the new page, specify the amount of funds in rubles to be
deposited and your mobile phone number which is used as an identifier in
the Visa QIWI Wallet payment system.
After the payment is confirmed, secure connection with Visa QIWI Wallet service is established, and you are offered to pay for an automatically generated invoice.
You can pay for it in several ways:
When depositing funds to your account, standard QIWI commission of 1% from the specified amount is charged. After the funds have been successfully transferred, they appear on your account immediately.
Choose the most convenient way to deposit funds to your account and use built-in MQL5.community services: Jobs freelance service, MetaTrader 4/5 AppStore and Trading Signals for MetaTrader platforms!Added display of the scalper Depth of Market for the symbols having no external one:
The new Depth of Market allows placing, modifying and deleting orders quickly and with maximum clarity providing best opportunities for profitable trading.
Added ability to place stop orders via the Depth of Market:
When pressing buy or sell button on a price level, the terminal automatically defines the type of the placed order - stop or limit - and passes it to the trade server.
Added command for displaying the history of deals on the chart:
Added display of Equity chart and signal reviews to the information about a signal. Added warning of the last trading transaction date.
bool ResourceReadImage( const string resource_name, // name of the graphic resource for reading uint& data[], // array for receiving data from the resource uint& width, // width of the copied area from the resource uint& height, // height of the copied area from the resource );
Fixed errors reported in crash logs.
Updated documentation.
The live update is available through the LiveUpdate system.
The MetaTrader 5 Trading Terminal can be downloaded at https://download.mql5.com/cdn/web/metaquotes.ltd/mt5/mt5setup.exe?utm_source=www.metatrader5.com