Good thread was created with visualized information - The Tips thread. It is strongly recommended to read this small thread to all the newbies (to know), and to experienced users (to refresh their knowledge).
----------------
Freelance service
How to deposit funds to your MQL5 account
How to proceed to the next stage
How to leave feedback
What is a screenshot
How to attach a file of a preliminary Requirements Specification/files of other formats
Things to be provided to a Developer if the program has an error
How to insert an image/code/video/table to a text
How to make a screenshot on a mobile device
How to extend order execution period/cost
Do not disappear for 5 days after setting 3 days for executionCustomer: How to create a GIF image, instead of a video, for embedding into a chat s
----------------
Platform
How to install an Expert Advisor/indicator
Where is the platform/tester/optimizer journal
Where is MetaQuotes ID for confugiring push notifications
How to make a screenshot of an error via the chart menu in three clicks
Where to enable and configure email notifications
Where are the files an EA/indicator works with
What are 'description' and 'icon' fields and where to find them
Where to find the platform build numberHow to enable the data window and see indicator values
How to enable the accurate time scale
How to save a chart template
How to add an URL to work via WebRequestWhere to find EX4/EX5 files
----------------
Expert Advisor
What is Magic Number
How trailing stop worksWhere is the EA's journal
Why is an EA/indicator gray in the Navigator
What is the difference between Netting and Hedging
How to install a product purchased in the Market
----------------
Tester
How to save/load a set file
Where to find the platform/tester/optimizer journal
How are test modes different from each other?
How to launch and use visual testing
How to download an available price history in MetaTrader 4
The beta version of the updated MetaTrader 5 platform is to be released on October 14, 2018. We will update our public MetaQuotes-Demo server located at access.metatrader5.com:443. We invite all traders to join testing in order to evaluate the updated platform features and to help developers fix errors.
To update the MetaTrader 5 platform up to build 1910, connect to access.metatrader5.com server:443.
The final build of the new MetaTrader 5 platform will be released after the public beta test.
The update will feature the following changes:
Terminal: Now you can detach financial symbol charts from the trading terminal window.
This feature is convenient when using multiple monitors. Thus, you may set the main platform window on one monitor to control your account state, and move your charts to the second screen to observe the market situation. To detach a chart from the terminal, disable the Docked option in its context menu. After that, move the chart to the desired monitor.
A separate toolbar on detached charts allows applying analytical objects and indicators without having to switch between monitors. Use the toolbar context menu to manage the set of available commands or to hide it.
Terminal: Fully updated the built-in chats. Now they support group dialogs and channels. Conduct private discussions with a group of people in a unified environment without switching between different dialogs and create channels according to your interests and languages. Communicate with colleagues and friends at MQL5.community without visiting the website.
Group chats and channels can be public or private. Their creators decide whether it is possible to join them freely or only by invitation. You can also assign moderators to channels and chats for additional communication control.
Terminal: Added support for increased volume accuracy for cryptocurrency trading. Now the minimum possible volume of trading operations is 0.00000001 lots. The market depth, the time and sales, as well as other interface elements now feature the ability to display volumes accurate to 8 decimal places.
The minimal volume and its change step depend on financial instrument settings on the broker's side.
Terminal: Added the tab of articles published on MQL5.community to the Toolbox window. Over 600 detailed materials on the development of trading strategies in MQL5 are now available without the need to leave the terminal. New articles are published weekly.
Terminal: Added support for extended authentication using certificates when working under Wine.
Terminal: Fixed display of the market depth when it is limited to one level.
Terminal: Added the "Save As Picture" command to the Standard toolbar. Now, it is much easier to take pictures of charts and share them in the community.
Terminal: Fixed applying the time shift when importing bars and ticks. Previously, the shift was not applied in some cases.
MQL5: Added native support for .NET libraries with "smart" functions import. Now .NET libraries can be used without writing special wrappers — MetaEditor does it on its own.
To work with .NET library functions, simply import DLL itself without defining specific functions. MetaEditor automatically imports all functions it is possible to work with:
Simple structures (POD, plain old data)
Structures with simple data types
Public static functions having parameters, in which only simple types and POD structures or their arrays are used
To call functions from the library, simply import it:
#import "TestLib.dll"//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
int x=6;
TestClass::Inc(x);
Print(x);
}
The C# code of the Inc function of the TestClass looks as follows:
As a result of execution, the script returns the value of 7.
MQL5: Added support for inline, __inline and __forceinline specifiers when parsing code. The presence of the specifiers in the code causes no errors and does not affect the compilation. At the moment, this feature simplifies transferring С++ code to MQL5. Find more information about specifiers in MSDN.
MQL5: Significantly optimized execution of MQL5 programs. In some cases, the performance improvement can reach 10%. Recompile your programs in the new MetaEditor version to make them run faster.
Unfortunately, new programs will not be compatible with previous terminal versions due to this additional optimization. Programs compiled in MetaEditor version 1910 and later cannot be launched in terminal versions below 1880. Programs compiled in earlier MetaEditor versions can run in new terminals.
TERMINAL_SCREEN_LEFT — the left coordinate of the virtual screen. A virtual screen is a rectangle that covers all monitors. If the system has two monitors ordered from right to left, then the left coordinate of the virtual screen can be on the border of two monitors.
TERMINAL_SCREEN_TOP — the top coordinate of the virtual screen.
TERMINAL_SCREEN_WIDTH — terminal width.
TERMINAL_SCREEN_HEIGHT — terminal height.
TERMINAL_LEFT — the left coordinate of the terminal relative to the virtual screen.
TERMINAL_TOP — the top coordinate of the terminal relative to the virtual screen.
TERMINAL_RIGHT — the right coordinate of the terminal relative to the virtual screen.
TERMINAL_BOTTOM — the bottom coordinate of the terminal relative to the virtual screen.
MQL5: Added volume_real field to the MqlTick and MqlBookInfo structures. It is designed to work with increased accuracy volumes. The volume_real value has a higher priority than 'volume'. The server will use this value, if specified.
struct MqlTick { datetime time; // Last price update time double bid; // Current Bid price double ask; // Current Ask price double last; // Current price of the Last trade ulong volume; // Volume for the current Last price long time_msc; // Last price update time in milliseconds uint flags; // Tick flags double volume_real; // Volume for the current Last price with greater accuracy };
struct MqlBookInfo
{
ENUM_BOOK_TYPE type; // order type from the ENUM_BOOK_TYPE enumerationdouble price; // pricelong volume; // volumedouble volume_real; // volume with greater accuracy
};
MQL5: Relaxed requirements for casting enumerations. In case of an implicit casting, the compiler automatically substitutes the value of a correct enumeration and displays a warning.
For the following code:
enum Main
{
PRICE_CLOSE_,
PRICE_OPEN_
};
input Main Inp=PRICE_CLOSE;
//+------------------------------------------------------------------+//| Start function |//+------------------------------------------------------------------+voidOnStart()
{
}
The compiler displays the warning:
implicit conversion from 'enum ENUM_APPLIED_PRICE' to 'enum Main' 'Main::PRICE_OPEN_' instead of 'ENUM_APPLIED_PRICE::PRICE_CLOSE' will be used
Previously, the following error was generated in that case:
'PRICE_CLOSE' - cannot convert enum
The compiler will still display the error if enumerations are used incorrectly in the function parameters.
MQL5: Fixed compilation of template functions. Now, when using overloaded template functions, only the necessary overload, rather than all existing ones, is instantiated.
class X { };
void f(int) { }
template<typename T>
void a(T*) { new T(2); } // previously, the compiler generated the error heretemplate<typename T>
void a() { f(0); }
voidOnInit() { a<X>(); }
MQL5: Optimized some cases of accessing tick history via the CopyTicks* function.
Tester: Fixed calculating the deposit currency accuracy when testing/optimizing and generating relevant reports.
Tester: Optimized and accelerated the strategy tester operation.
MetaEditor: Fixed search for entire words. Now when searching, the underscore is counted as a regular character, rather than a word delimiter.
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors ... in general, any questions from beginner to the MQL5 language.
If you are just starting to get acquainted with the MetaTrader 5 terminal, then I can recommend the following threads:
Why products are checked before they are published in the Market
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products.
If any errors are identified by the Market moderators in the process of checking your product, you will have to fix all of them. This article considers the most frequent errors made by developers in their trading robots and technical indicators. We also recommend reading the following articles:
The Economic Calendar is our proprietary solution. Therein you will find over 600 financial news and indicators related to the 13 largest global economies: USA, European Union, Japan, UK, Canada, Australia, China among others. Relevant data is collected from open sources in real time.
The new version features updated contents and advanced event filters: by time, priority, currencies and countries.
The calendar data can now be accessed from MQL5 programs. Please see below for details.
Terminal: Added new type of MQL5 applications — Services. This new type enables the creation of custom price feeds for the terminal, i.e. to implement price delivery from external systems in real time, just like it is implemented on brokers' trade servers.
Unlike Expert Advisors, indicators and scripts, services are not linked to a specific chart. Such applications run in the background and are launched automatically when the terminal is started (unless such an app was forcibly stopped).
Services can be managed from a new section within the Navigator window:
How to create services To create a service template, use the corresponding MQL5 Wizard option. Services have one OnStart entry point, similar to scripts. At this point, you can implement an endless data receiving and handling cycle using network functions.
How to launch services To run multiple Expert Advisor or indicator copies with different parameters, you should launch them on different charts. In this case different program instances are created, which then operate independently. Services are not linked to charts, therefore a special mechanism has been implemented for the creation of service instances.
Select a service from the Navigator and click "Add service" in its context menu. This will open a standard MQL5 program dialog, in which you can enable/disable trading and access to signal settings, as well as set various parameters.
A service instance can be launched and stopped using the appropriate instance menu. To manage all instances, use the service menu.
Terminal: A learning program has been added.
The new feature will help beginners in learning how to interact with the platform. We have added over 100 interactive tips concerning the main platform features.
Tips are seamlessly displayed as a progress bar on the toolbar and thus they do not distract the user.
Tips only appear for the actions which you have never performed in the platform.
All tips include interactive links, by which you can navigate to the relevant interface elements. For example, a trading dialog or a menu with the desired program can be launched straight from the tip.
The filled area of the progress bar will increase whenever you perform appropriate actions and continue training.
Terminal: The trading account history can be presented as positions. The platform collects data on deals related to the position (opening, volume increase, partial or full closing) and groups the information into a single record. Thus you can access position details: open and close time, volume, price and result. This efficient presentation form is now available in history reports exported to files.
Terminal: Added new API enabling request of MetaTrader 5 terminal data through applications using the R language.
We have prepared a special MetaTrader package. It contains DLL for interactions between R and the MetaTrader 5 terminal, documentation and auxiliary r files. We are completing the package registration in the CRAN repository, after which it will be available for download and installation.
The package can be installed using a special command:
R CMD INSTALL --build MetaTrader
The following commands related to data request are available:
MT5Initialize initializes and establishes connection with the MetaTrader 5 terminal. If necessary, the terminal is launched during command execution.
MT5Shutdown de-initializes and disconnects from MetaTrader 5.
MT5Version gets the MetaTrader 5 terminal version.
MT5TerminalInfo gets the state and parameters of terminal connection to a broker's server (account number and server address).
MT5WaitTerminal waits for the MetaTrader 5 terminal to connect to a broker's server.
MT5CopyTicksFrom(symbol, from, count, flags) copies the specified number of ticks starting from the specified date. The date is specified in milliseconds since 01.01.1970.
MT5CopyTicksRange(symbol, from, to, flags) copies ticks from within the specified period. The dates are specified in milliseconds since 01.01.1970.
MT5CopyRatesFrom(symbol, timeframe, from, count) copies the specified number of one-minute bars starting from the specified date. The date is specified in seconds since 01.01.1970.
MT5CopyRatesFromPos(symbol, timeframe, start_pos, count) copies one-minute bars from the specified position relative to the last bar.
MT5CopyRatesFromRange(symbol, timeframe, date_from, date_to) copies bars from within the specified period. The dates are specified in seconds since 01.01.1970.
The list of supported commands will be further expanded.
Terminal: Optimized Close By dialog used for closing a position by an opposite one. Now, the dialog is not slowed down even if you have a large number of open positions.
Terminal: Fixed synthetic symbol calculation errors, due to which data could be occasionally skipped.
Terminal: When a custom symbol is deleted, files storing its tick and bar history are also deleted. This avoids the accumulation of unused data on the hard disk.
Terminal: Fixed display of search results on High DPI screens.
MQL5: Implemented access to economic calendar data from MQL5 programs.
New functions
CalendarCountryById — gets country description by identifier.
bool CalendarCountryById(
constlong country_id, // country ID
MqlCalendarCountry& country // country description
);
CalendarEventById — gets event description by identifier.
CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
bool CalendarValueHistoryByEvent(
ulong event_id, // event ID
MqlCalendarValue& values[], // array of valuesdatetime datetime_from, // period beginning datedatetime datetime_to=0 // period end date
);
CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or currency.
bool CalendarValueHistory(
MqlCalendarValue& values[], // array of valuesdatetime datetime_from, // beginning of perioddatetime datetime_to=0, // end of periodstring country_code=NULL, // country codestring currency=NULL // currency
);
CalendarValueLastByEvent — gets an array of last event values by identifier. This function enables the request of the values which have appeared since the previous request. The in/out parameter "change_id" is additionally used for this operation.
Every time the calendar database changes, the "change_id" property (the last change identifier) is updated. During data request, you specify "change_id" and the terminal returns events which appeared after that time, as well as the current "change_id" value, which can be used for the next request. During the first function call, specify the zero "change_id": the function will not return any events, but will return the current "change_id" for further requests.
bool CalendarValueHistory(
ulong event_id, // event IDulong& change_id, // last calendar change ID
MqlCalendarValue& values[] // array of values
);
CalendarValueLast — gets the array of last values for all events, filtered by country and/or currency. This function enables the request of the values which have appeared since the previous request. Similarly to CalendarValueLastByEvent, the "change_id" property is used for the request.
bool CalendarValueHistory(
ulong event_id, // event IDulong& change_id, // last calendar change ID
MqlCalendarValue& values[], // array of valuesstring country_code=NULL, // country codestring currency=NULL // currency
);
New structures
MqlCalendarCountry — country description.
struct MqlCalendarCountry
{
ulong id; // country ID in ISO 3166-1string name; // text name of the countrystring code; // code name of the country in ISO 3166-1 alpha-2string currency; // country currency codestring currency_symbol; // country currency symbol/signstring url_name; // country name used in URL on mql5.com
};
MqlCalendarEvent — event description.
struct MqlCalendarEvent
{
ulong id; // event ID
ENUM_CALENDAR_EVENT_TYPE type; // event type
ENUM_CALENDAR_EVENT_SECTOR sector; // sector to which the event belongs
ENUM_CALENDAR_EVENT_FREQUENCY frequency; // event release frequency
ENUM_CALENDAR_EVENT_TIMEMODE time_mode; // event release time modeulong country_id; // country ID
ENUM_CALENDAR_EVENT_UNIT unit; // unit for the event values
ENUM_CALENDAR_EVENT_IMPORTANCE importance; // event importance
ENUM_CALENDAR_EVENT_MULTIPLIER multiplier; // event importance multiplieruint digits; // number of decimal places in the event valuestring source_url; // source URLstring event_code; // event codestring name; // text name of the event in the terminal language
};
MqlCalendarValue — event value description.
struct MqlCalendarValue
{
ulong id; // value IDulong event_id; // event IDdatetime time; // event date and timedatetime period; // period, for which the event is publishedint revision; // published indicator revision in relation to the reported periodlong actual_value; // current event valuelong prev_value; // previous event valuelong revised_prev_value; // revised previous event valuelong forecast_value; // forecast event value
ENUM_CALENDAR_EVENT_IMPACRT impact_type; // potential impact on the currency rate
};
New enumerations
enum ENUM_CALENDAR_EVENT_FREQUENCY
{
CALENDAR_FREQUENCY_NONE =0, // not used
CALENDAR_FREQUENCY_WEEK =1, // weekly
CALENDAR_FREQUENCY_MONTH =2, // monthly
CALENDAR_FREQUENCY_QUARTER =3, // quarterly
CALENDAR_FREQUENCY_YEAR =4, // yearly
CALENDAR_FREQUENCY_DAY =5, // daily
};
enum ENUM_CALENDAR_EVENT_TYPE
{
CALENDAR_TYPE_EVENT =0, // event (meeting, speech, etc.)
CALENDAR_TYPE_INDICATOR =1, // indicator
CALENDAR_TYPE_HOLIDAY =2, // holiday
};
enum ENUM_CALENDAR_EVENT_SECTOR
{
CALENDAR_SECTOR_NONE =0, // no
CALENDAR_SECTOR_MARKET =1, // market
CALENDAR_SECTOR_GDP =2, // GDP
CALENDAR_SECTOR_JOBS =3, // jobs
CALENDAR_SECTOR_PRICES =4, // prices
CALENDAR_SECTOR_MONEY =5, // money
CALENDAR_SECTOR_TRADE =6, // trade
CALENDAR_SECTOR_GOVERNMENT =7, // government
CALENDAR_SECTOR_BUSINESS =8, // business
CALENDAR_SECTOR_CONSUMER =9, // consumer
CALENDAR_SECTOR_HOUSING =10, // housing
CALENDAR_SECTOR_TAXES =11, // taxes
CALENDAR_SECTOR_HOLIDAYS =12, // holidays
};
enum ENUM_CALENDAR_EVENT_IMPORTANCE
{
CALENDAR_IMPORTANCE_LOW =0, // no
CALENDAR_IMPORTANCE_NONE =1, // low
CALENDAR_IMPORTANCE_MODERATE =2, // moderate
CALENDAR_IMPORTANCE_HIGH =3, // high
};
enum ENUM_CALENDAR_EVENT_UNIT
{
CALENDAR_UNIT_NONE =0, // no
CALENDAR_UNIT_PERCENT =1, // percent
CALENDAR_UNIT_CURRENCY =2, // national currency
CALENDAR_UNIT_HOUR =3, // number of hours
CALENDAR_UNIT_JOB =4, // number of jobs
CALENDAR_UNIT_RIG =5, // number of rigs
CALENDAR_UNIT_USD =6, // US dollar
CALENDAR_UNIT_PEOPLE =7, // number of people
CALENDAR_UNIT_MORTGAGE =8, // number of mortgages
CALENDAR_UNIT_VOTE =9, // number of votes
CALENDAR_UNIT_BARREL =10, // number of barrels
CALENDAR_UNIT_CUBICFEET =11, // volume in cubic feet
CALENDAR_UNIT_POSITION =12, // number of job positions
CALENDAR_UNIT_BUILDING =13// number of buildings
};
enum ENUM_CALENDAR_EVENT_MULTIPLIER
{
CALENDAR_MULTIPLIER_NONE =0, // no
CALENDAR_MULTIPLIER_THOUSANDS =1, // thousands
CALENDAR_MULTIPLIER_MILLIONS =2, // millions
CALENDAR_MULTIPLIER_BILLIONS =3, // billions
CALENDAR_MULTIPLIER_TRILLIONS =4, // trillions
};
enum ENUM_CALENDAR_EVENT_IMPACRT
{
CALENDAR_IMPACT_NA =0, // not available
CALENDAR_IMPACT_POSITIVE =1, // positive
CALENDAR_IMPACT_NEGATIVE =2, // negative
};
enum ENUM_CALENDAR_EVENT_TIMEMODE
{
CALENDAR_TIMEMODE_DATETIME =0, // the source publishes the exact time
CALENDAR_TIMEMODE_DATE =1, // the event takes the whole day
CALENDAR_TIMEMODE_NOTIME =2, // the source does not publish the event time
CALENDAR_TIMEMODE_TENTATIVE =3, // the source provides only date, but does not publish the exact time in advance, exact time is added when event occurs
};
New error codes
ERR_CALENDAR_MORE_DATA =5400, // the array is small for the whole result (values which fit in the array were passed)
ERR_CALENDAR_TIMEOUT =5401, // timed out waiting for a response to the calendar data request
ERR_CALENDAR_NO_DATA =5402, // data not found
MQL5: Fixes and operation speed improvements related to tick and bar history.
MQL5: Fixes and significant operation speed improvements related to tick and bars history modification functions of custom trading symbols, CustomTicks* and CustomRates*.
MQL5: Added network functions for creating TCP connections to remote hosts via system sockets:
SocketCreate creates a socket with specified flags and returns its handle
SocketClose closes the socket
SocketConnect connects to the server, with timeout control
SocketIsConnected checks if the socket is currently connected
SocketIsReadable gets the number of bytes which can be read from the socket
SocketIsWritable checks if data writing to this socket is possible at the current time
SocketTimeouts sets data receiving and sending timeouts for the system socket object
SocketRead reads data from a socket
SocketSend writes data to a socket
SocketTlsHandshake initiates a secure TLS (SSL) connection with the specified host using the TLS Handshake protocol
SocketTlsCertificate receives information concerning the certificate used for secure network connection
SocketTlsRead reads data from a secure TLS connection
SocketTlsReadAvailable reads all available data from a secure TLS connection
SocketTlsSend sends data using a secure TLS connection
The address of the host, to which connection using network functions is established, must be explicitly added to the list of allowed addresses in terminal settings.
New error codes have been added for operations with network functions:
ERR_NETSOCKET_INVALIDHANDLE (5270): invalid socket handle passed to the function
ERR_NETSOCKET_TOO_MANY_OPENED (5271): too many sockets open (maximum 128)
ERR_NETSOCKET_CANNOT_CONNECT (5272): error while connecting to remote host
ERR_NETSOCKET_IO_ERROR (5273): error while sending/receiving data from the socket
ArrayRemove removes from an array the specified number of elements starting with the specified index.
bool ArrayRemove(
void& array[], // array of any typeuint start, // the index to start removaluint count=WHOLE_ARRAY // number of elements
);
ArrayInsert inserts to a receiver array the specified number of elements from the source array, starting with the specified index.
bool ArrayInsert(
void& dst_array[], // receiver arrayconstvoid& src_array[], // source arrayuint dst_start, // index in the receiver array where to insertuint src_start=0, // index in the source array to start copyinguint count=WHOLE_ARRAY // number of inserted elements
);
ArrayReverse reverses in an array the specified number of elements starting with the specified index.
bool ArrayReverse(
void& array[], // array of any typeuint start=0, // index to start reversinguint count=WHOLE_ARRAY // number of elements
);
MQL5: New "uint count" parameter has been added in functions CustomRatesUpdate, CustomRatesReplace, CustomTicksAdd and CustomTicksReplace. It allows specification of the number of elements of the passed array, which will be used for these functions. The WHOLE_ARRAY value is used for the parameter by default. It means that the whole array will be utilized.
MQL5: Added CustomBookAdd function to pass the status of the Depth of Market for a custom symbol. The function allows broadcasting the Depth of Market as if the prices arrive from a broker's server.
int CustomBookAdd(
conststring symbol, // symbol nameconst MqlBookInfo& books[] // an array with the DOM elements descriptionsuint count=WHOLE_ARRAY // number of elements to be used
);
MQL5: Added CustomSymbolCreate function overloading. This allows the creation of a custom trading symbol based on an existing one. After creation, any symbol property can be edited using corresponding functions.
boolCustomSymbolCreate(
conststring symbol_name, // custom symbol nameconststring symbol_path="", // name of the group in which the symbol will be createdconststring symbol_origin=NULL // name of the symbol based on which the custom symbol will be created
);
The name of the symbol, from which the properties of for the custom symbol should be copied, is specified in the "symbol_origin" parameter.
The StringToTime function converting the string with date/time to a datetime value has been updated. Now it supports the following date formats:
yyyy.mm.dd [hh:mi]
yyyy.mm.dd [hh:mi:ss]
yyyymmdd [hh:mi:ss]
yyyymmdd [hhmiss]
yyyy/mm/dd [hh:mi:ss]
yyyy-mm-dd [hh:mi:ss]
MQL5: New TERMINAL_VPS property in the ENUM_TERMINAL_INFO_INTEGER enumeration; it shows that the terminal is running on the MetaTrader Virtual Hosting server (MetaTrader VPS). If an application is running on a hosting server, you can disable all its visual functions, since the virtual server does not have a graphical user interface.
MQL5: New SYMBOL_EXIST property in the ENUM_SYMBOL_INFO_INTEGER enumeration, means that the symbol under this name exists.
MQL5: Fixed typing when using template function pre-declarations.
MQL5: Added re-initialization of indicators when changing a trading account.
MQL5: Fixed errors in the standard library operation.
Tester: Added TesterStop function — routine early shutdown of an Expert Advisor on a test agent. Now you can forcibly stop testing after reaching the specified number of losing trades, a preset drawdown level or any other criterion.
Testing completed using this function is considered successful. After the function call, the trading history obtained during testing and all trade statistics are passed to the terminal.
Tester: Disabled ability to test and optimize Expert Advisors through MQL5 Cloud Network in the real tick mode. This mode can only be used on local agents and local network farms.
Tester: Improved work with indicators during visual testing. Now the price chart and indicator lines are drawn synchronously, even for the maximum visualization speed.
Tester: Optimized and significantly accelerated testing and optimization.
Tester: Fixed debugging of indicators on historical data. Now the OnInit and OnDeinit indicator functions can be properly debugged.
Tester: Implemented faster access to historical data when testing multicurrency Expert Advisors.
Tester: Fixed occasional freezing of the visual tester during debugging on historical data.
Tester: Implemented faster start of optimization passes when processing a task package by an agent.
Tester: Changed policy of distributing task packages to testing agents. The package size has been increased and thus resource consumption on network operations has been significantly reduced.
Tester: Changed behavior of options enabling the use of local, network and cloud agents. Now, when you switch off the options, the agents complete processing of received tasks, while no more new tasks are given to them. In earlier versions, the behavior was similar to the "Disable" command, which immediately stopped agent operation.
MetaEditor: Added support for non-ANSI characters in the debugger. Now, the expressions are properly displayed even if the variable name is specified in Cyrillic.
MetaEditor: Fixed display of search results on High DPI screens.
Added user interface translation into Croatian.
Documentation has been updated.
The update will be available through the LiveUpdate system.
Do I need to remove my build 1940 before installing this 2005? I tried without uninstalling and after install it is same 1940 as before. Also, I have been unable to update since last year, any reason? Should I remove all and retry?
Coming soon -
New communication system an analogue of the Telegram - read this post.
============
Ichimoku
The beginning
After
============
Good thread was created with visualized information - The Tips thread.
It is strongly recommended to read this small thread to all the newbies (to know), and to experienced users (to refresh their knowledge).
----------------
Freelance service
----------------
Platform
----------------
Expert Advisor
----------------
Tester
This is very important and very interesting update - please read it -
Forum on trading, automated trading systems and testing trading strategies
MetaTrader 5 Platform Beta Build 1910: Unbound drag-and-drop of charts and .Net libraries in MQL5
MetaQuotes Software Corp., 2018.10.12 19:43
The beta version of the updated MetaTrader 5 platform is to be released on October 14, 2018. We will update our public MetaQuotes-Demo server located at access.metatrader5.com:443. We invite all traders to join testing in order to evaluate the updated platform features and to help developers fix errors.
The final build of the new MetaTrader 5 platform will be released after the public beta test.
The update will feature the following changes:
This feature is convenient when using multiple monitors. Thus, you may set the main platform window on one monitor to control your account state, and move your charts to the second screen to observe the market situation. To detach a chart from the terminal, disable the Docked option in its context menu. After that, move the chart to the desired monitor.

A separate toolbar on detached charts allows applying analytical objects and indicators without having to switch between monitors. Use the toolbar context menu to manage the set of available commands or to hide it.Group chats and channels can be public or private. Their creators decide whether it is possible to join them freely or only by invitation. You can also assign moderators to channels and chats for additional communication control.
The minimal volume and its change step depend on financial instrument settings on the broker's side.
To work with .NET library functions, simply import DLL itself without defining specific functions. MetaEditor automatically imports all functions it is possible to work with:
To call functions from the library, simply import it:
The C# code of the Inc function of the TestClass looks as follows:
As a result of execution, the script returns the value of 7.
Find more information about specifiers in MSDN.
Added the following properties to the ENUM_CHART_PROPERTY_INTEGER enumeration:
Added the following functions to the ENUM_TERMINAL_INFO_INTEGER enumeration:
struct MqlTick
{
datetime time; // Last price update time
double bid; // Current Bid price
double ask; // Current Ask price
double last; // Current price of the Last trade
ulong volume; // Volume for the current Last price
long time_msc; // Last price update time in milliseconds
uint flags; // Tick flags
double volume_real; // Volume for the current Last price with greater accuracy
};
Use the SymbolInfoDouble function to get these properties.
For the following code:
The compiler displays the warning:
'Main::PRICE_OPEN_' instead of 'ENUM_APPLIED_PRICE::PRICE_CLOSE' will be used
Good thread was started - How to start with MQL5
Forum on trading, automated trading systems and testing trading strategies
How to start with MQL5
Vladimir Karputov, 2018.12.24 20:34
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors ... in general, any questions from beginner to the MQL5 language.
If you are just starting to get acquainted with the MetaTrader 5 terminal, then I can recommend the following threads:
How to Start with Metatrader 5
Where do i start from?
Use tips in the Freelance service!
There is one article which every seller on the market should read: it is about validation of the Market products -
----------------
The checks a trading robot must pass before publication in the Market
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products.
If any errors are identified by the Market moderators in the process of checking your product, you will have to fix all of them. This article considers the most frequent errors made by developers in their trading robots and technical indicators. We also recommend reading the following articles:
Thanks man...
Very helpful, great effort...
Forum on trading, automated trading systems and testing trading strategies
New MetaTrader 5 Platform build 2005: Economic Calendar, MQL5 applications as services and R language API
MetaQuotes Software Corp., 2019.02.20 17:20
The MetaTrader 5 platform update will be released on February 21, 2019. The new version features the following changes:
- Terminal: Completely revised built-in Economic Calendar.

- Terminal: Added new type of MQL5 applications — Services. This new type enables the creation of custom price feeds for the terminal, i.e. to implement price delivery from external systems in real time, just like it is implemented on brokers' trade servers.

- Terminal: A learning program has been added.

- Terminal: The trading account history can be presented as positions. The platform collects data on deals related to the position (opening, volume increase, partial or full closing) and groups the information into a single record. Thus you can access position details: open and close time, volume, price and result. This efficient presentation form is now available in history reports exported to files.

- Terminal: Added new API enabling request of MetaTrader 5 terminal data through applications using the R language.

R CMD INSTALL --build MetaTrader
- MT5Initialize initializes and establishes connection with the MetaTrader 5 terminal. If necessary, the terminal is launched during command execution.
- MT5Shutdown de-initializes and disconnects from MetaTrader 5.
- MT5Version gets the MetaTrader 5 terminal version.
- MT5TerminalInfo gets the state and parameters of terminal connection to a broker's server (account number and server address).
- MT5WaitTerminal waits for the MetaTrader 5 terminal to connect to a broker's server.
- MT5CopyTicksFrom(symbol, from, count, flags) copies the specified number of ticks starting from the specified date. The date is specified in milliseconds since 01.01.1970.
- MT5CopyTicksRange(symbol, from, to, flags) copies ticks from within the specified period. The dates are specified in milliseconds since 01.01.1970.
- MT5CopyRatesFrom(symbol, timeframe, from, count) copies the specified number of one-minute bars starting from the specified date. The date is specified in seconds since 01.01.1970.
- MT5CopyRatesFromPos(symbol, timeframe, start_pos, count) copies one-minute bars from the specified position relative to the last bar.
- MT5CopyRatesFromRange(symbol, timeframe, date_from, date_to) copies bars from within the specified period. The dates are specified in seconds since 01.01.1970.
- Terminal: Optimized Close By dialog used for closing a position by an opposite one. Now, the dialog is not slowed down even if you have a large number of open positions.
- Terminal: Fixed synthetic symbol calculation errors, due to which data could be occasionally skipped.
- Terminal: When a custom symbol is deleted, files storing its tick and bar history are also deleted. This avoids the accumulation of unused data on the hard disk.
- Terminal: Fixed display of search results on High DPI screens.
- MQL5: Implemented access to economic calendar data from MQL5 programs.
- MQL5: Fixes and operation speed improvements related to tick and bar history.
- MQL5: Fixes and significant operation speed improvements related to tick and bars history modification functions of custom trading symbols, CustomTicks* and CustomRates*.
- MQL5: New data conversion functions.
- Added MathSwap function for changing byte order in ushort, uint and ulong values.
- MQL5: Added network functions for creating TCP connections to remote hosts via system sockets:
- SocketCreate creates a socket with specified flags and returns its handle
- SocketClose closes the socket
- SocketConnect connects to the server, with timeout control
- SocketIsConnected checks if the socket is currently connected
- SocketIsReadable gets the number of bytes which can be read from the socket
- SocketIsWritable checks if data writing to this socket is possible at the current time
- SocketTimeouts sets data receiving and sending timeouts for the system socket object
- SocketRead reads data from a socket
- SocketSend writes data to a socket
- SocketTlsHandshake initiates a secure TLS (SSL) connection with the specified host using the TLS Handshake protocol
- SocketTlsCertificate receives information concerning the certificate used for secure network connection
- SocketTlsRead reads data from a secure TLS connection
- SocketTlsReadAvailable reads all available data from a secure TLS connection
- SocketTlsSend sends data using a secure TLS connection
The address of the host, to which connection using network functions is established, must be explicitly added to the list of allowed addresses in terminal settings.
- ERR_NETSOCKET_INVALIDHANDLE (5270): invalid socket handle passed to the function
- ERR_NETSOCKET_TOO_MANY_OPENED (5271): too many sockets open (maximum 128)
- ERR_NETSOCKET_CANNOT_CONNECT (5272): error while connecting to remote host
- ERR_NETSOCKET_IO_ERROR (5273): error while sending/receiving data from the socket
- ERR_NETSOCKET_HANDSHAKE_FAILED (5274): secure connection establishment error (TLS Handshake)
- ERR_NETSOCKET_NO_CERTIFICATE (5275) — no data about certificate used for secure connection
- MQL5: Added new functions for string operations:
- MQL5: Added new function for array operations:
- MQL5: New "uint count" parameter has been added in functions CustomRatesUpdate, CustomRatesReplace, CustomTicksAdd and CustomTicksReplace. It allows specification of the number of elements of the passed array, which will be used for these functions. The WHOLE_ARRAY value is used for the parameter by default. It means that the whole array will be utilized.
- MQL5: Added CustomBookAdd function to pass the status of the Depth of Market for a custom symbol. The function allows broadcasting the Depth of Market as if the prices arrive from a broker's server.
- MQL5: Added CustomSymbolCreate function overloading. This allows the creation of a custom trading symbol based on an existing one. After creation, any symbol property can be edited using corresponding functions.
- The StringToTime function converting the string with date/time to a datetime value has been updated. Now it supports the following date formats:
- yyyy.mm.dd [hh:mi]
- yyyy.mm.dd [hh:mi:ss]
- yyyymmdd [hh:mi:ss]
- yyyymmdd [hhmiss]
- yyyy/mm/dd [hh:mi:ss]
- yyyy-mm-dd [hh:mi:ss]
- MQL5: New TERMINAL_VPS property in the ENUM_TERMINAL_INFO_INTEGER enumeration; it shows that the terminal is running on the MetaTrader Virtual Hosting server (MetaTrader VPS). If an application is running on a hosting server, you can disable all its visual functions, since the virtual server does not have a graphical user interface.
- MQL5: New SYMBOL_EXIST property in the ENUM_SYMBOL_INFO_INTEGER enumeration, means that the symbol under this name exists.
- MQL5: Fixed typing when using template function pre-declarations.
- MQL5: Added re-initialization of indicators when changing a trading account.
- MQL5: Optimized StringSplit function.
- MQL5: Fixed errors in the standard library operation.
- Tester: Added TesterStop function — routine early shutdown of an Expert Advisor on a test agent. Now you can forcibly stop testing after reaching the specified number of losing trades, a preset drawdown level or any other criterion.
- Tester: Disabled ability to test and optimize Expert Advisors through MQL5 Cloud Network in the real tick mode. This mode can only be used on local agents and local network farms.
- Tester: Improved work with indicators during visual testing. Now the price chart and indicator lines are drawn synchronously, even for the maximum visualization speed.
- Tester: Optimized and significantly accelerated testing and optimization.
- Tester: Fixed debugging of indicators on historical data. Now the OnInit and OnDeinit indicator functions can be properly debugged.
- Tester: Implemented faster access to historical data when testing multicurrency Expert Advisors.
- Tester: Fixed occasional freezing of the visual tester during debugging on historical data.
- Tester: Implemented faster start of optimization passes when processing a task package by an agent.
- Tester: Changed policy of distributing task packages to testing agents. The package size has been increased and thus resource consumption on network operations has been significantly reduced.
- Tester: Changed behavior of options enabling the use of local, network and cloud agents. Now, when you switch off the options, the agents complete processing of received tasks, while no more new tasks are given to them. In earlier versions, the behavior was similar to the "Disable" command, which immediately stopped agent operation.

- MetaEditor: Added support for non-ANSI characters in the debugger. Now, the expressions are properly displayed even if the variable name is specified in Cyrillic.
- MetaEditor: Fixed display of search results on High DPI screens.
- Added user interface translation into Croatian.
- Documentation has been updated.
The update will be available through the LiveUpdate system.The Economic Calendar is our proprietary solution. Therein you will find over 600 financial news and indicators related to the 13 largest global economies: USA, European Union, Japan, UK, Canada, Australia, China among others. Relevant data is collected from open sources in real time.
The new version features updated contents and advanced event filters: by time, priority, currencies and countries.
The calendar data can now be accessed from MQL5 programs. Please see below for details.
Unlike Expert Advisors, indicators and scripts, services are not linked to a specific chart. Such applications run in the background and are launched automatically when the terminal is started (unless such an app was forcibly stopped).
Services can be managed from a new section within the Navigator window:
How to create services
To create a service template, use the corresponding MQL5 Wizard option. Services have one OnStart entry point, similar to scripts. At this point, you can implement an endless data receiving and handling cycle using network functions.
How to launch services
To run multiple Expert Advisor or indicator copies with different parameters, you should launch them on different charts. In this case different program instances are created, which then operate independently. Services are not linked to charts, therefore a special mechanism has been implemented for the creation of service instances.
Select a service from the Navigator and click "Add service" in its context menu. This will open a standard MQL5 program dialog, in which you can enable/disable trading and access to signal settings, as well as set various parameters.

A service instance can be launched and stopped using the appropriate instance menu. To manage all instances, use the service menu.The new feature will help beginners in learning how to interact with the platform. We have added over 100 interactive tips concerning the main platform features.
- Tips are seamlessly displayed as a progress bar on the toolbar and thus they do not distract the user.
- Tips only appear for the actions which you have never performed in the platform.
- All tips include interactive links, by which you can navigate to the relevant interface elements. For example, a trading dialog or a menu with the desired program can be launched straight from the tip.
The filled area of the progress bar will increase whenever you perform appropriate actions and continue training.We have prepared a special MetaTrader package. It contains DLL for interactions between R and the MetaTrader 5 terminal, documentation and auxiliary r files. We are completing the package registration in the CRAN repository, after which it will be available for download and installation.
The package can be installed using a special command:
The following commands related to data request are available:
The list of supported commands will be further expanded.
New functions
CalendarCountryById — gets country description by identifier.
CalendarEventById — gets event description by identifier.
CalendarValueById — gets event value description by identifier.
CalendarEventByCountry — gets the array of available events for the country.
CalendarEventByCurrency — gets the array of available events for the affected currency.
CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or currency.
CalendarValueLastByEvent — gets an array of last event values by identifier. This function enables the request of the values which have appeared since the previous request. The in/out parameter "change_id" is additionally used for this operation.
Every time the calendar database changes, the "change_id" property (the last change identifier) is updated. During data request, you specify "change_id" and the terminal returns events which appeared after that time, as well as the current "change_id" value, which can be used for the next request. During the first function call, specify the zero "change_id": the function will not return any events, but will return the current "change_id" for further requests.
CalendarValueLast — gets the array of last values for all events, filtered by country and/or currency. This function enables the request of the values which have appeared since the previous request. Similarly to CalendarValueLastByEvent, the "change_id" property is used for the request.
New structures
MqlCalendarCountry — country description.
MqlCalendarEvent — event description.
MqlCalendarValue — event value description.
New enumerations
New error codes
CharArrayToStruct copies a uchar array to a POD structure.
StructToCharArray copies a POD structure to a uchar array.
New error codes have been added for operations with network functions:
StringReserve reserves for a string the memory buffer of the specified size.
StringSetLength sets the specified string length in characters.
ArrayRemove removes from an array the specified number of elements starting with the specified index.
ArrayInsert inserts to a receiver array the specified number of elements from the source array, starting with the specified index.
ArrayReverse reverses in an array the specified number of elements starting with the specified index.
The name of the symbol, from which the properties of for the custom symbol should be copied, is specified in the "symbol_origin" parameter.
Testing completed using this function is considered successful. After the function call, the trading history obtained during testing and all trade statistics are passed to the terminal.
Hello.
Do I need to remove my build 1940 before installing this 2005?
I tried without uninstalling and after install it is same 1940 as before.
Also, I have been unable to update since last year, any reason?
Should I remove all and retry?
Thanks...