Discover in 15 Minutes: Video on Trading Signals.
General information on Trading Signals for MetaTrader 4 and MetaTrader 5 How to Prepare a Trading Account for Migration to Virtual Hosting Translated from Russian by MetaQuotes Software Corp. SignalSubscribe - Trade Signals - MQL4 Reference. SignalSubscribe. Subscribes to the trading signal. bool SignalSubscribe (long signal_id // signal id); Parameters. signal_id [in] Signal identifier. Returned value. Returns true if subscription was successful, otherwise returns false.
The MQL4 predefined variable Bars will be discussed in this short tutorial. How to create a simple MT4 expert advisor template that trades once per bar? Have you ever wished you had a simple template to create expert advisors? Building on the previous MQL4 tutorial, this two segment sample shows how to put together a simple expert advisor that uses the RSI indicator to give trade signals. This tutorial provides a simple generalized template that may be followed for future expert advisor development.
MarketInfo is one of the most useful and can be the most difficult MQL4 functions to understand for some traders. This simple set of examples explores how to put MarketInfo to use in referencing data on other charts for use in the OrderClose function. If you have suggestions for a tutorial or code sample or questions about any of the code on this site, please leave me a comment. Triangular Arbitrage Lot Size. Pairs Trading MT4 Indicator.
Clean Up All Objects. One Trade Per Bar. MT4 Script "Must Knows". Expert Advisor Live Trading. In some cases a program can be written to support a dialog with a user. Function MessageBox is used for this purpose. MessageBox function creates and displays a message box, it is also used to manage the dialog window. A message box contains a message and header defined ina program, as well as any combination of predefined icons and push buttons.
If a function is executed successfully, the returned value is one of the return code values of MessageBox.
The function cannot be called from a custom indicator, because indicators are executed in the interface thread and may not decelerate it. If the parameter is empty, an EA name will be displayed in the box header; flags - optional flags defining the type and behavior of the dialog box. Flags can be a combination of flags from flag groups see MessageBox Return Codes.
The EA supporting a dialog with a user dialogue. In the block WinUser During the whole period of EA execution a question about closing orders should be displayed only once.
To trace whether the question has been already displayed in the EA 'Question' variable is declared. At each start of the special function start block PlaySound is executed.
The decision about using sound in a program is made by a programmer. In some cases it is very useful to use sounds. For example, a sound may denote the fact of an EA execution. Other sounds may correspond to other events, for example triggering of a trading criterion, order closing, etc. In the EA conditions, at which the message box must be displayed, are analyzed. If there is one or several orders, the message box has not been shown yet and the server time differs from important news release time by less than 5 minutes, certain actions are performed in the program.
First of all function PlaySound is executed, the played sound attracts the attention of a user. The Question flag gets the true value do not show the next time. In the next line MessageBox is executed:. In this case the value of a string constant "Time of important news release.
As a result of the execution of MessageBox with indicated parameters a message box is displayed:. Dialog box displayed as a result of MessageBox execution.
At the moment when the message box is shown the program execution is held up until a user clicks on a button in the message box. As soon as it happens, control will be passed to the line following MessageBox call, in this case to the block This property of a message box to hold control is very important and it must be taken into account at a program development.
For example, if a user left his computer and a message box was shown at this moment, during the whole time when a user is absent until a button is pressed , the program will be waiting for response and no code will be executed in this period. Note, before a message box is displayed the program execution is accompanied by a sound of ticks.
When the message box is displayed another sound is played. In the period when the dialog box is open and waiting for response no sound is played which illustrates the fact of control holding while the dialog box is open. After a button is pressed, the program execution will continue and the sound of ticks will be played again.
In this example the function contents is not described; to denote its execution the Alert function is executed "Function of closing all orders is being executed. If a user clicks No, the function of closing orders is not called. In the current session of the EA execution the message box will not be shown again. For the detailed description of these and other functions please refer to Documentation at MQL4. Comment Function void Comment For the reproduction of sound files PlaySound function is used.
Let us consider an example of MessageBox usage. Write a code of an EA displaying a message box with a question of closing all orders 5 minutes prior to important news release. If a user clicks Yes, all orders should be closed, if No is pushed, no actions should be performed. In the next line MessageBox is executed: As a result of the execution of MessageBox with indicated parameters a message box is displayed: Parameters may be of any type.
If you are a successful trader and would like to make money using your experience and skills, you can register as a Provider in the Signals service via MQL5.
This is the group of functions intended for managing trade signals.