Firstly,
I added two variables:
VarC = "________determine pairs for open orders";
Pair_Master = "EURUSD";
Pair_Slave = "USDCHF";
These variables are used to determine the correlated pairs on which the Expert Advisor will open trades. This new addition serves two main purposes:
You can attach the Expert Advisor to just one chart, and it will trade on the pairs specified inside it, without the need to manually open the pairs.
More importantly, you can now conduct complete backtests on any two correlated pairs and obtain precise results. This is a significant advantage of MetaTrader 5, where you can perform backtests on multiple pairs, a feature lacking in MetaTrader 4.
Secondly,
I added the 'Equity Profits' code directly into the Expert Advisor itself, instead of creating a separate Expert Advisor. Complete details can be found at the following link.
https://forum.arabictrader.com/t2640...ml#post3437942
Here are the external inputs for 'Equity Profits':
input autoEquity_profits = false;
input percent_profits = 4;
input equity_profits = 1000;
If you set 'autoEquity_profits' to 'true', you can specify the percentage of profit you want to achieve from the earned profits using the 'percent_profits' parameter. A value of 4 means dividing the earned profits in the account balance by 4.
and write here on "equity_profits" write a number is not logical to achieve like that equity_profits=514248745;
Thirdly,
I added an RSI indicator, which works when 'DirectionWith_master' is set to 'true.' This means that if there is an overbought or oversold condition in the master pair (e.g., EURUSD), a trade will be opened on the master pair, and, for example, the slave pair (e.g., USDCHF) will be traded. However, you must ensure that 'DirectionWith_slave' is set to 'false.'
If you want to trade based on the Moving Average direction rather than RSI, simply set 'DirectionWith_slave' to 'true' and 'DirectionWith_master' to 'false.' This way, it will work according to the direction of the slave pair (e.g., USDCHF).
You can also switch between the two pairs like this:
Pair_Master = "USDCHF";
Pair_Slave = "EURUSD";
Fourthly and finally,
The "WithoutDistances" variable means that the Expert Advisor opens a new trade at each crossing of the moving average without relying on distances, whether cooling or reinforcement. But if you want to work with this setting, then you must set all the cooling and reinforcement settings to "false."