You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
New MetaTrader 5 Build 1210: Enhanced Depth of Market and General Improvements
MetaTrader 5 platform update is to be released on Friday, October 30, 2015. The update will feature the following changes:
If we drag a limit order through ask/bid border, it will change to a stop order (Buy Limit will be replaced by Buy Stop, while Sell Limit - by Sell Stop). Hold Crtl while dragging so that a limit order is not replaced by a stop one.
The update will be available through the LiveUpdate system.
New MetaTrader 5 Platform Build 1240: Faster operation and embedded videos
MetaTrader 5 platform update is to be released on Thursday, December 17, 2015. The update will feature the following changes:
This video as well as many others is available on the official MetaQuotes Software Corp. YouTube channel.MetaEditor: Added a link to the tutorial video "How to Create a Trading Robot in the MQL5 Wizard" to the MQL5 Wizard. Watch this three-minute video and develop a trading robot without writing a single line of code.
This video as well as many others is available on the official MetaQuotes Software Corp. YouTube channel.The update will be available through the LiveUpdate system.
New MetaTrader 5 build 1325: Hedging option and testing on real ticks
MetaTrader 5 platform update is to be released on Friday, April 22, 2016. The new version features the following changes:
Since the new system is similar to the one used in MetaTrader 4, it will be familiar to traders. At the same time, traders will be able to enjoy all the advantages of the fifth platform version — filling orders using multiple deals (including partial fills), multicurrency and multithreaded tester with support for MQL5 Cloud Network, and much more.
Now, you can use one account to trade the markets that adhere to the netting system and allow having only one position per instrument, and use another account in the same platform to trade Forex and apply hedging.
Opening a hedge account and viewing position accounting type
A position accounting system is set at an account level and displayed in the terminal window header and the Journal:
To open a demo account with hedging, enable the appropriate option:Netting system
With this system, you can have only one common position for a symbol at the same time:
It does not matter, what has caused the opposite deal — an executed market order or a triggered pending order.
The below example shows execution of two EURUSD Buy deals 0.5 lots each:
Execution of both deals resulted in one common position of 1 lot.
Hedging system
With this system, you can have multiple open positions of one and the same symbol, including opposite position.
If you have an open position for a symbol, and execute a new deal (or a pending order triggers), a new position is additionally opened. Your current position does not change.
The below example shows execution of two EURUSD Buy deals 0.5 lots each:
Execution of these deals resulted in opening two separate positions.
New trade operation type - Close By
The new trade operation type has been added for hedging accounts — closing a position by an opposite one. This operation allows closing two oppositely directed positions at a single symbol. If the opposite positions have different numbers of lots, only one order of the two remains open. Its volume will be equal to the difference of lots of the closed positions, while the position direction and open price will match (by volume) the greater of the closed positions.
Compared with a single closure of the two positions, the closing by an opposite position allows traders to save one spread:
In the latter case, a "close by" order is placed. Tickets of closed positions are specified in its comment. A pair of opposite positions is closed by two "out by" deals. Total profit/loss resulting from closing the both positions is specified only in one deal.
Testing and optimization on real ticks are as close to real conditions as possible. Instead of generated ticks based on minute data, it is possible to use real ticks accumulated by a broker. These are ticks from exchanges and liquidity providers.
To start testing or optimization in real ticks, select the appropriate mode in the strategy tester:
Tick data has greater size compared to minute one. Downloading it may take quite a long time during the first test. Downloaded tick data is stored by months in TKC files in \bases\[trade server name]\ticks\[symbol name]\.Testing on real ticks
When testing on real ticks, a spread may change within a minute bar, whereas when generating ticks within a minute, a spread fixed in the appropriate bar is used.
If the Market Depth is displayed for a symbol, the bars are built strictly according to the last executed trade price (Last). Otherwise, the tester first attempts to build the bars by Last prices, and in case of their absence, uses Bid ones. OnTick event is triggered on all ticks regardless of whether the Last price is present or not.
Please note that trading operations are always performed by Bid and Ask prices even if the chart is built by Last prices. For example, if an Expert Advisor using only bar open prices for trading (i.e., the built-in Moving Average) receives a signal at Last price, it performs a trade at another price (Bid or Ask depending on the direction). If "Every tick" mode is used, the bars are built by Bid prices, while trades are performed by Bid and Ask ones. The Ask price is calculated as Bid + fixed spread of a corresponding minute bar.
If a symbol history has a minute bar with no tick data for it, the tester generates ticks in the "Every tick" mode. This allows testing the EA on a certain period in case a broker's tick data is insufficient. If a symbol history has no minute bar but the appropriate tick data for the minute is present, these ticks are ignored. The minute data is considered more reliable.
Testing on real ticks in the MQL5 Cloud Network
Testing on real ticks is available not only on local and remote agents, but also through the MQL5 Cloud Network. Optimization of a strategy that could take months, can be completed in a few hours using the computing power of thousands of computers.
To test a strategy using the MQL5 Cloud Network, enable the use of cloud agents:
Tests on real ticks using the MQL5 Cloud Network can consume a lot of data. This can significantly affect the payment for the use of the network power.
A welcome dialog appears when first connecting to the account migrated from MetaTrader 4. Data transmission is securely encrypted during migration. To get started, specify the password of your account that you used in MetaTrader 4, and then set a new password.
Once connected, you will be able to continue using your account, just as if it has been opened in MetaTrader 5. The complete history of all trades from MetaTrader 4 is automatically added to the new account.The tickets of orders and positions (including history orders) are not preserved during import, because one history record from MetaTrader 4 can be imported as up to 4 history operations in MetaTrader 5. New tickets are assigned to all trading records.
The account numbers can be preserved or replaced depending on how the broker imports them.
EX5 programs compiled in build 1325 and above will not run in old terminal builds - backward compatibility is not supported.
Abstract classes are used for creating generic entities that you expect to use for creating more specific derived classes. An abstract class can only be used as the base class for some other class, that is why it is impossible to create an object of the abstract class type.
A class which contains at least one pure virtual function in it is abstract. Therefore, classes derived from the abstract class must implement all its pure virtual functions, otherwise they will also be abstract classes.
A virtual function is declared as "pure" by using the pure-specifier syntax. Consider the example of the CAnimal class, which is only created to provide common functions – the objects of the CAnimal type are too general for practical use. Thus, CAnimal is a good example for an abstract class:
Here Sound() is a pure virtual function, because it is declared with the specifier of the pure virtual function PURE (=0).
Pure virtual functions are only the virtual functions for which the PURE specifier is set: (=NULL) or (=0). Example of abstract class declaration and use:
Restrictions on abstract classes
If the constructor for an abstract class calls a pure virtual function (either directly or indirectly), the result is undefined.
However, constructors and destructors for abstract classes can call other member functions.
To declare a pointer to a function, specify the "pointer to a function" type, for example:
Now, TFunc is a type, and it is possible to declare the variable pointer to the function:
The func_ptr variable may store the function address to declare it later:
Pointers to functions can be stored and passed as parameters. You cannot get a pointer to a non-static class method.
bool PositionSelectByTicket( ulong ticket // position ticket );
Margin calculation for hedged positions is described in details in the MetaTrader 5 trading platform Help.
CPosition
Added methods:
CTrade
Added methods:
Added overloading for the methods:
CAccountInfo
Changed the methods:
Added methods:
CExpert
Added methods:
The update will be available through the LiveUpdate system.
New MetaTrader 5 Platform build 1340: Convenient transfer of certificates to mobile devices and Strategy Tester improvements
MetaTrader 5 platform update is to be released on Friday, May 13, 2016. The update will feature the following changes:
The trading platform supports extended authentication by protecting a trade account using an SSL certificate in addition to a password. The certificate is a file that is individually generated for an account on the trade server. This file is unique, and account connection is not possible without the certificate.
In the earlier platform versions, any certificate requested and generated from the desktop terminal needed to be manually copied and installed on the device to enable use of the trading account from the MetaTrader 5 Mobile for iPhone/iPad or Android. Now, certificates can be conveniently transfered.
The Process of Certificate Transfer
A certificate is transfered via a trade server:
Certificate transfer process is secure: the trade server is only used as an intermediate storage, while the certificate is encrypted on the client's side. The certificate password is not transmitted to or stored on the trade server.
How to Transfer a Certificate
Connect to your account from the desktop terminal and select "Transfer Certificate" in its context menu:
Enter the master password of the account to confirm that it belongs to you. Next, set a password to protect the certificate before sending it to the server. Set a password that has at least 8 digits.After successfully sending the certificate to the server, open the mobile terminal and connect to your account. You will immediately be prompted to import the certificate. Confirm and enter the password that you have set from the desktop terminal.
You can view the imported certificate in the "About — Certificates" section.What's New for Exchange Instruments
In the real market, charts of exchange-traded instruments are generated based on Last price information (the price of the last executed deal). Stop Orders also trigger at the Last price. Limit orders trigger at Bid and Ask prices. All types of orders are always executed at the current market Bid/Ask prices. The Strategy Tester has been updated and now better emulates real market conditions:
Last for Stop, Stop-Limit and SL/TP orders
Let us consider an example of the Si-6.16 symbol. A new Buy Stop order with the trigger price = 72580 is set while the current prices are: Bid=72570, Ask=72572, Last=72552. New current prices are received in a price stream:
A trigger for Stop-Orders of exchange instruments is the Last price. So the Last price=72580 received in the stream activates the Buy Stop order. In the earlier versions, the same price would be used to execute this order. This behavior is incorrect, because there is no Ask=72580 in the market to execute the Buy transaction.
The current Ask=72590 is used in the updated tester version, so the Buy Stop order is executed at this price. The new trade execution algorithm in the Tester is closer to real market conditions. The trade operation would be executed at a non-market price when using the previous algorithm, which would lead to inaccurate testing results.What's New for Other Instruments
The algorithm has not changed for other instruments: Bid/Ask prices are used for all types of pending orders, as well as for SL and TP. However, the execution mode has changed: in earlier versions, orders were executed at the price specified in the order. Now market Bid and Ask prices as of the time of order activation are used.
What's New in Visual Testing
During visual testing, the bar's High Ask and Low Bid price lines are now shown in the tester. On such charts, it is more convenient to test Expert Advisors that trade exchange instruments, because bars of such instruments, as well as order triggering are based on the Last prices, while market operations are executed at Bid and Ask prices.
New option on the visual testing chart: navigation to a specified date. Double-click on the chart and enter the desired date and time. It is also possible to navigate to any order or trade: double-click on the appropriate trading operation on the Trade, History or Operations tab.2016.05.10 12:47:53 Core 1 GBPUSD: history synchronization completed [5225 Kb]
The update will be available through the LiveUpdate system.
New MetaTrader 5 Platform build 1375: Time & Sales and access to ticks during testing
MetaTrader 5 platform update is to be released on Friday, July 15, 2016. The update will feature the following changes:What is Time & Sales?
The Time & Sales feature provides the price and time of every trade executed on the exchange. Information on every trade includes the time when the trade was executed, its direction (buying or selling), as well as the price and volume of the trade. For easy visual analysis, different colors are used to indicate different trade directions: blue is used for Buy trades, pink for Sell trades, green means undefined direction. Trade volumes are additionally displayed in a histogram.
How Time & Sales can help you understand the market
The Time & Sales feature provides tools for a more detailed market analysis. The trade direction suggests who has initiated the trade: the buyer or the seller. The volume of trades allows traders to understand the behavior of market participants: whether the trades are performed by large or small market players, as well as estimate the activity of the players. The trade execution speed and the volume of trades on various price levels help traders to estimate the importance of the levels.
How to use Time & Sales data
In addition to the visual analysis of the table, you can save the details of trades to a CSV file. Further, they can be analyzed using any other software, such as MS Excel. The file contains comma-separated data:
2016.07.06 16:05:04.305,89360,89370,89370,4,Buy
2016.07.06 16:05:04.422,89360,89370,89370,2,Buy
2016.07.06 16:05:04.422,89360,89370,89370,10,Buy
2016.07.06 16:05:04.669,89360,89370,89370,1,Buy
2016.07.06 16:05:05.968,89360,89370,89360,7,Sell
When real ticks are used in testing, milliseconds are taken from the source tick data. When ticks are generated, milliseconds are set in accordance with the tick volume. For example, if 3 ticks fit within one second, their millisecond time will be equal to 000, 333 and 666.
The forward testing window is only opened after testing on the main period is completed.
The below diagram shows the previous (red arrow) and current behavior of the function:
The update will be available through the LiveUpdate system.
New MetaTrader 5 build 1395: Faster trade operations and visual testing improvements
MetaTrader 5 platform update is to be released on Friday, August 19, 2016. The new version features the following changes:
It is recommended to use the operator dynamic_cast<class name *>(void * pointer) in order to cast back. If conversion is not possible, the result is NULL.
The update will be available through the LiveUpdate system.
New MetaTrader 5 Build 1430: Updated Exposure tab
The Assets section is helpful for those trading Forex or futures at an exchange showing their current status on the market. Same currencies can be found in a variety of different symbols: as one of the currencies in a pair, as a base currency, etc. For example, you may have oppositely directed positions on GBPUSD, USDJPY and GBPJY. In this situation, it is very difficult to understand how much currency you have and how much you need. Having more than three positions further complicates the task. In this case, the total account status can be easily seen in the Assets tab.
Let's use the same three positions as an example:
Buy GBPJPY 1 lot at 134.027 — received 100 000 GBP, given 134 027 000 JPY
Sell USDJPY 1 lot at 102.320 — given 100 000 USD, received 102 320 000 JPY
Sell GBPUSD 1 lot at 1.30923 — given 100 000 GBP, received 103 920 USD
We have bought and sold 100 000 GPB simultaneously. We have 0 GBP, and the Assets tab does not display this currency. As of USD, we gave a currency in one case and received it in another. The Assets tab calculates the final outcome and adds it to the current balance since the deposit currency is USD as well. JPY participated in two deals meaning that the tab displays its total value.
Those using the exchange model can use the section to understand how their money is used. Unlike the previous model, the funds are withdrawn/added right when deals are performed. For example, if you buy EURRUB, you receive EUR at once while the appropriate sum in RUB is withdrawn from the balance. During trading, the account balance may even become negative: when you use borrowed money while purchased assets are used as the collateral. In this case, the Assets tab allows you to easily understand the trading account status.
Additionally, you can see the liquidation value here — amount of funds on the account and the price (result) of closing all current positions at the market price.
'final' modifier for classes and structures
The presence of the 'final' modifier when declaring a structure or a class prohibits the further inheritance from it. If there is no need to make any further changes in the class (structure) or such changes are unacceptable for security reasons, declare that class (structure) with the 'final' modifier. In this case, all class methods are also implicitly considered 'final'.
When attempting to inherit from a class with the 'final' modifier as shown above, the compiler displays an error:
see declaration of 'CFoo'
'override' modifier for functions
The 'override' modifier means that a declared function should always override the parent class method. Using the modifiers allows you to avoid errors when overriding, such as accidental change of a method signature. For example, the 'func' method accepting the 'int' type variable is defined in the base class:
The method is overridden in the inherited class:
But the argument type is mistakenly changed from 'int' to 'short'. In fact, the method overload instead of overriding is performed in that case. While acting according to the overloaded function definition algorithm, the compiler may in some cases select a method defined in the base class instead of an overridden one.
In order to avoid such errors, the 'override' modifier should be explicitly added to the overridden method.
If the method signature is changed during the overriding process, the compiler cannot find the method with the same signature in the parent class issuing the compilation error:
'final' modifier for functions
The 'final' modifier acts in the opposite way — it disables method overriding in derived classes. If the method implementation is self-sufficient and fully completed, declare it with the 'final' modifier to ensure it is not changed later.
When attempting to override a method with the 'final' modifier as shown above, the compiler displays an error:
see declaration of 'CFoo::func'
The update will be available through the LiveUpdate system.
New MetaTrader 5 Platform Build 1455: Libraries of mathematical functions in MQL5
MetaTrader 5 platform update is to be released on Friday, October 14, 2016. The new version features the following changes:
Terminal: Added tooltips for the Buy, Sell and Close buttons in trade dialogs. The tooltips contain information about the security to be bought or sold during the operation, to help beginners understand the trading process.
MQL5: An MQL5 version of the ALGLIB numerical analysis library has been included into the Standard Library.
Library Features
How to Use
ALGLIB files are located in \MQL5\Include\Math\Alglib. To use the functions, add the main library file into your program:
MQL5: Mathematical statistics functions have been included into the Standard Library. MQL5 now provides the functionality of the R language, which is one of the best tools for statistical data processing and analysis.
Library Features
The statistical library contains functions for calculating the statistical characteristics of data, as well as functions for operations with statistical distributions:
How to Use
The statistical library files are located in \MQL5\Include\Math\Stat. To use the library, add the file with required functions into your program, for example:
The detailed description of the library functions is available in the article Statistical Distributions in MQL5 - Taking the Best of R.
MQL5: The MQL5 version of the Fuzzy library has been included into the Standard Library. The Fuzzy library implements Mamdani and Sugeno fuzzy inference systems.
Library Features
How to Use
Fuzzy Library files are located in \MQL5\Include\Math\Fuzzy. To use the library, add the file with required functions into your program, for example:
A detailed description of the library is available in the Code Base: Fuzzy - library for developing fuzzy models
The navigation bar is opened by pressing Enter or Space. It allows you to quickly move to the specified date on the chart, as well as to switch symbols and timeframes. If your MQL5 program processes Enter or Space key pressing, disable the CHART_QUICK_NAVIGATION property, in order to avoid interception of these events by the terminal. The quick navigation bar can still be opened by a double click.An example of how to write ticks to a file and then read them:
If one color is specified, all candlesticks on the chart will be fully painted in this color.
If two colors are specified, one color is used for candlestick edges, the other one is used for the body.
If three colors are specified, one color is used for candlestick edges, two other colors are used for the bodies of bullish and bearish candlesticks.
The DRAW_CANDLES style allows setting custom colors of candlesticks. All colors can also be changed dynamically while the indicator is running, using the function PlotIndexSetInteger(drawing_index_DRAW_CANDLES, PLOT_LINE_COLOR, modifier_number, color) where modifier_number can have the following values:
The update will be available through the LiveUpdate system.
New MetaTrader 5 Build 1485: Additional testing mode and graphics in the Standard Library
The MetaTrader 5 platform update is to be released on Thursday, November 24, 2016. The new version features the following changes:
In addition, it is now possible to hide the 'Time' and 'Source' columns using the journal context menu.
ArrayPrint does not print all fields of a structure array to logs – array fields and pointer fields of objects are skipped. If you want to print all fields of a structure, you should use a custom function for the mass printing with a desired formatting.
Plotting a chart based on three data series using GraphPlot:
The result:
Plotting a chart based on a data array using GraphPlot:The result:
Only the random delay mode was available in earlier versions.The update will be available through the LiveUpdate system.
New MetaTrader 5 Build 1490: Improvements and Fixes
A new version of the MetaTrader 5 platform will be released on December 2, 2016. We have fixed a number of bugs based on crash logs and user reports, in order to make the platform even more convenient for you.
The update will be available through the LiveUpdate system.