Discussing the article: "Developing a multi-currency Expert Advisor (Part 6): Automating the selection of an instance group"

 

Check out the new article: Developing a multi-currency Expert Advisor (Part 6): Automating the selection of an instance group.

After optimizing the trading strategy, we receive sets of parameters. We can use them to create several instances of trading strategies combined in one EA. Previously, we did this manually. Here we will try to automate this process.

In the previous article, we have implemented the ability to choose the strategy option - with a constant position size and with a variable position size. This allowed us to introduce normalization of the results of the strategies' work according to the maximum drawdown and provided the possibility of combining them into groups, for which the maximum drawdown was also within the specified limits. For the sake of demonstration, we manually selected several of the most attractive combinations of inputs from the optimization results of a single strategy instance and tried to combine them into one group or even into a group of three groups of three strategies. We got the best results in the latter case.

However, if we need to increase the number of strategies in groups and the number of different groups being combined, then the volume of routine manual work increases greatly. 

First, we need to optimize a single instance of the strategy with different optimization criteria on each symbol. Moreover, for each symbol, it may be necessary to carry out separate optimization for different timeframes. For our specific model strategy, we can also perform separate optimization by types of orders opened (stop, limit or market positions).

Second, from the resulting sets of parameters, which amount to about 20-50 thousand, it is necessary to select a small number (10-20) of the best ones. However, they should be the best not only on their own, but also when working together in a group. Selecting and adding strategy instances one by one also takes time and patience.

Third, the obtained groups should in turn be combined into higher groups, carrying out standardization. If you do this manually, you can only afford two or three levels. More levels of grouping seem too labor-intensive.

Author: Yuriy Bykov

 

Thank you! :)

 

Great article and system :)

- We apply a min-max scaling to each of them, leading to the range [0; 1]. We get additional columns with the suffix '_s' ,

Yuri, how did you do it? I searched in exel and didn't see anything like that in the functions. Did you write your own formula for this or how did you do it? Google for the query min-max scaling in Excel didn't give me anything normal either....

 
Viktor Kudriavtsev #:

Great article and system :)

- We apply a min-max scaling to each of them, leading to the range [0; 1]. We get additional columns with suffix '_s' ,

Yuri, how did you do it? I searched in exel and didn't see anything like that in the functions there.

Victor, thanks for your feedback!

I don't know a special function in Excel either, I do it like this:

 
Yuriy Bykov #:

Victor, thanks for the feedback!

I don't know any special function in Excel either, I do it like this:

Thanks Yuri.

But you wrote about adding columns Profit,Expected Payoff,Profit Factor,Recovery Factor,Sharpe Ratio,Equity DD %,Trades, with _s. What order should I add them in to make it work? Each column after the original column or can they all be added at the end of the table? Could you make a screenshot of the column names as you do from your table already edited, or just attach a small file already edited for a sample.

Also, when you optimise the Expert Advisor, do you set a complex criterion or just balance max? I tried it and I have something not very large number of trades in the passages finds, about 100-180 trades for 5 years.

And please tell me, if I would like your EA to read the signal and open trades at the opening of a new bar on a given timeframe, but accompanied trades every tick as it works now. Where should I add the function of checking the occurrence of a new bar to work like this?

 

The order of addition only matters in terms of how to do it faster. It was faster for me to add these columns at the end of the table (columns AC:AI), then calculate the deviations in several new columns (AJ : AP), then sum AJ:AP in A Q , then find the maximum scaling factor Scale in AR, and calculate the ratio Res = AR/AQ in AS. To sort by it, you have to copy only the values from AS to a new AT column. I have attached an example.

I start optimisation with the complex criterion and then all other criteria. The number of deals can be different, including relatively small. It depends on the size of SL and TP levels.

In the next article I plan to tell you about the function of checking a new bar and how it can be applied there.

Files:
 
Yuriy Bykov number of deals can be different, including relatively small. It depends on the size of SL and TP levels.

In the next article I plan to tell you about the function of checking a new bar and how it can be applied there.

Yuri, thank you for the example table, I understand it is from the last article (7), it will also be useful, but I asked you for an example of the table from this article (6), which you feed to the input of the OptGroupClusterExpert.mq5 Expert Advisor . As I understand this table is called Params_SV_EURGBP_H1-with_cluster.csv and Params_SV_EURGBP_H1.csv. That's what I asked you for. Please attach these tables as an example.

About the next article cool! Let's wait:) If it would be nice to add to the strategy the possibility of time filter for each strategy (specify start and end times of the trading period) and some filters on indicators (2-3 pieces). then I think it would be a great EA for trading the whole market :).

 

Victor, yes indeed, got a bit ahead of myself with the previous table example.

I have attached an example for Params_SV_EURGBP_H1.xlsx, as the CSV file will no longer contain formulas. You will need to save it to CSV, and if Excel uses ';' as a delimiter, you will need to replace ';' with ',' in the entire CSV file. The Params_SV_EURGBP_H1-with_cluster.csv file is obtained automatically using the Python code from Params_SV_EURGBP_H1.csv given in the article.

As for adding time filters and additional indicators: the architecture used allows it - you can create new classes of trading strategies (successors of CVirtualStrategy) with any desired filters and indicators. I do not plan to use time filters for myself, as I have never managed to improve trading results by introducing time constraints. I don't plan to use many indicators in one strategy, because strong filtering of input signals is less important for me. It can be obtained indirectly by combining several instances of strategies that use one different indicator each, for example.