Is it possible to build a multicurrency Expert Advisor using the wizard? How can I programme this situation:
there are two positions on different instruments, EURUSD.PROFIT=1000 (1lot) and GBPUSD.PROFIT=-450 (1lot) need to close partially both positions so that the total profit~0 (EURUSD.PROFIT~250 (?lot) and GBPUSD.PROFIT~-250 (?lot))
Is it possible to build a multicurrency Expert Advisor using the wizard? How can I programme this situation:
there are two positions on different instruments, EURUSD.PROFIT=1000 (1lot) and GBPUSD.PROFIT=-450 (1lot) it is necessary to close partially both positions so that the total profit~0 (EURUSD.PROFIT~250 (?lot) and GBPUSD.PROFIT~-250 (?lot))
With the help of the Wizard, you will be able to build any Expert Advisor (including multi-currency, solving the situation described in your post).
The only thing to understand is that the Wizard is a tool for assembling a "house" from "cubes". Some set of "cubes" exists in the standard library.
Unfortunately, none of the standard "cubes" implements an algorithm like: "it is necessary to close partially both positions so that the total profit~0".
Many bright ideas are not implemented yet, but you have the opportunity to write your own classes implementing the algorithms you need.
Two articles have already been published:
"MQL5 Wizard: How to Write Your Trading Signals Module" and "MQL5 Wizard: How to Write Your Capital and Risk Management Module".
The article "MQL5 Wizard: How to Write Your Open Position Maintenance Module" is almost ready for publication

- 2010.12.15
- MetaQuotes Software Corp.
- www.mql5.com
Hey, Bulat,
Very good stuff you tell us, programming like this, in modules, is fine to me because at this moment
I`am learning MT5 stuff so it`s takes a while to code. Now within three minutes Iam into the game!
thank Rob.
The article is a very significant instruction on the way how to develop more advanced experts with ease.
However, I'm having trouble replacing built-in signalindicators with my custom indicator.
The generator recognizes my indicator but the expert refuses to work.
Is there an article/post on how to do it properly?
- 2009.11.23
- Андрей
- www.mql5.com
Gentlemen, can you please explain how to deal with
-----------------------------------------------
The mechanism of making trading decisions on the basis of signal modules
The mechanism of making trading decisions can be presented in the form of the following basic provisions:
- Each of the signal modules has its own set of market models (a certain combination of prices and indicator values).
- Each market model is assigned a significance measured from 1 to 100. The higher the value, the stronger the model.
- Each of the models generates a forecast of price movement in a certain direction.
- The forecast of the signals module is the result of the search of embedded models and is given as a number in the range from -100 to +100, where the sign determines the direction of the expected movement (negative - the price will fall, positive - the price will rise). The absolute value corresponds to the strength of the found best model.
- The forecast of each module is sent for voting with a weight coefficient from 0 to 1.0 specified in its settings ("Weight").
- The result of the voting is a number from -100 to +100, where the sign defines the direction of the predicted movement, and the absolute value characterises the signal strength. It is calculated as the arithmetic mean of weighted forecasts of all signal modules. This final value is used in the Expert Advisor to make trading decisions.
In the settings of each generated Expert Advisor there are two parameters - threshold values for making a decision to open or close a position (ThresholdOpen and ThresholdClose), which can have values from 0 to 100. If the strength of the final signal (absolute value) overcomes the threshold value, a decision is made to make a trading operation in the direction corresponding to the sign of the forecast.
-----------------------------------------------
Examples
Let there be a certain Expert Advisor with the threshold values ThresholdOpen=20 and ThresholdClose=90. Signals modules based on MA with the weight of 0.4 and Stochastic with the weight of 0.8 are involved in making decisions about trading operations. Let's consider two variants of the received trading signals:
Variant 1.
The price crossed the ascending MA indicator from bottom to top. This corresponds to one of the market models inherent in the MA module, which implies price growth. Its significance is equal to 100. At the same time the Stochastic oscillator turned downwards and formed a divergence with the price. This is one of the Stochastic models embedded in the Stochastic module, suggesting a price drop. The significance of this model is equal to 80.
Let's calculate the result of the final vote. The weighted forecast obtained from the MA module is calculated as 0.4 * 100 = 40. The weighted forecast from the Stochastic module is calculated as 0.8 * (-80) = -64. The final forecast is calculated by finding the arithmetic mean of these two weighted forecasts: (40 - 64)/2 = -12. This is a sell signal with a conditional strength of 12. The threshold value equal to 20 has not been reached. Accordingly, the trade operation is not performed.
--------------------------------------------
Where do the model values come from?
As far as I understand, in the example below, the AC Module generates 4 variants of signals - what is the significance of each of them?
Or am I missing something?
|
Accelerator Oscillator Indicator Signals
This signals module is based on market models of the Accelerator Oscillator indicator. The mechanism of making trading decisions based on the module signals is described in a separate section.
Signal generation conditions
Below is a description of the conditions under which the module sends a signal to the Expert Advisor.
Signal type | Description of conditions |
---|---|
Buy |
|
For Sell |
|
Not against buying | The indicator value is growing on the bar being analysed. |
Not against selling | The indicator value on the analysed bar is falling. |
Note
Depending on the Expert Advisor operation mode ("Every Tick" or "At Open Prices"), the bar being analysed is either the current bar (with index 0) or the last formed bar (with index 1).
Customisable parameters
This module has the following customisable parameters:
Parameter | Description |
---|---|
Weight | Weight of the module signal in the range from 0 to 1. |
Yes, I looked, in all models of trading signals there are at least 4 significances?
For buying
For selling
Not against buying
Not against selling
https://www.mql5.com/en/docs/standardlibrary/expertclasses/csignal
But nowhere is there any information - how much each value weighs in numbers...................
At the same time, the example talks about the significance of each model in figures
Examples
Let there be a certain Expert Advisor with threshold values ThresholdOpen=20 and ThresholdClose=90. The signal modules based on MA with the weight of 0.4 and Stochastic with the weight of 0.8 are involved in making decisions about trading operations. Let's consider two variants of the received trading signals:
Variant 1.
The price crossed the ascending MA indicator from bottom to top. This corresponds to one of the market models inherent in the MA module, assuming the price growth. Its significance is equal to 100. At the same time the Stochastic oscillator turned downwards and formed a divergence with the price. This is one of the Stochastic models, which suggests the price falling. The significance of this model is equal to 80.
Let's calculate the result of the final vote. The weighted forecast obtained from the MA module is calculated as 0.4 * 100 = 40. The weighted forecast from the Stochastic module is calculated as 0.8 * (-80) = -64. The final forecast is calculated by finding the arithmetic mean of these two weighted forecasts: (40 - 64)/2 = -12. This is a sell signal with a conditional strength of 12. The threshold value equal to 20 has not been reached. Accordingly, the trade operation is not performed.
Where do the values highlighted in red come from?

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Create Your Own Expert Advisor in MQL5 Wizard is published: