Question on genetic optimisation - page 4

 

So only this iCustom line is changed? Then we need to look at this indicator in detail.

 

You have the wrong topic. You are concentrating on optimisation, while the problem is obviously with the EA(parameter transfers etc). Forget about the optimisation for a while, put comment's and printers in the EA, run with different parameters in the visual, controlling the intermediate data, find all the errors, and then go back to the optimisation.

The same results indicate that the optimised parameters do not affect the formation of the trading signal, and this is the problem of the EA, not the tester.

 
Angela >> :

If I set the parameters like this: (iCustom(NULL, 0, "ART", MA_Period, KFK, 0, 1), Digits); - all zeros appear, as I gave an example above.

If I set iCustom(NULL, 0, "ART", 0, 1), Digits); - then calculated values appear,

but they are all the same, although in the tester, when running with different parameters, the results of the trades are very different.

Angela, for optimization to work, you have to use the values changed by the optimizer in the algorithm somehow, in particular you have to pass them to the indicator. It is necessary to pass parameters to the indicator, if you want to optimize it. When you call the indicator without parameters (i.e. the second case iCustom(NULL, 0, "ART", 0, 1)), you actually omit the parameters and it works with the default ones, that are registered inside ART (of course they aren't optimized). The full call with parameters - the first option - is what you need for optimization. Most likely, the problem is that you don't pass parameters correctly. For example, if their number in the indicator is less, and you pass a better value, or vice versa, if you don't give them all parameters. If the indicator is a secret, at least give the list of its parameters.

 

Thanks to everyone, the reason was trivial. The order in which the parameters sent from the indicator to the EA did not match:

in the Expert Advisor was

extern int MA_Period=151; // 101 10 201
extern double KFK=0.9; // 0.7 0.005 1.

in the indicator on the contrary

extern double KFK=0.9; // 0.7 0.005 1.

extern int MA_Period=151; // 101 10 201

it worked in the visualization mode, but not in the optimization mode.

 

Congratulations. I also remember struggling with passing parameters, until I got used to being scrupulous. Now I copy a piece of indicator code with all externs into Expert Advisor and write iCustom, looking at the sample. It is a bit obtuse, but since then there are no errors.

And one more thing. I have looked up komposter's illustrative style of writing iCustom. Everything is right in the palm of my hand.

/*
Входные параметры индикатора
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
*/
double signal=iCustom(Symbol(),Period(),"MACD",
                                       FastEMA,   //параметр 1
                                       SlowEMA,   //параметр 2
                                       SignalSMA, //параметр 3
                                       0,         //номер буфера индикатора    
                                       SignalBar);//бар, с которого получаем данные (внешняя переменная)
 

I am debugging the second version of my TS, in comparison with the first one the number of deals has increased and the number of optimizable parameters has decreased significantly, although the drawdown has doubled.

However I have some doubts, the system is not very stable from month to month. I have not optimized it yet but the result with GA will be available in 48 hours. 800+ runs are not encouraging and optimization results in June are worse than those of testing with the initial parameters for the same period. I bring three stats, for June, July and August, so far I've debugged only Buy. Can I pull such a system out due to optimization with stable results or should I start to develop a new one right away?

Strategy Tester Report
ABC_exp
Alpari-Demo (Build 225)

Symbol GBPUSD (Great Britain Pound vs US Dollar)
Period 5 Minutes (M5) 2009.06.01 00:00 - 2009.06.30 23:59 (2009.06.01 - 2009.07.01)
Model By open prices (only for Expert Advisors with explicit bar opening control)
Parameters Lots=0.1; TrailingStop1=3110; StopLoss1=1500; TrailingStop2=3110; StopLoss2=1500; MAGIC_1=12345; MAGIC_2=23456; MA_Period=151; KFK=0.9;
Bars in history 7288 Modelled ticks 13573 Simulation quality n/a
Chart mismatch errors 0
Initial deposit 1000.00
Net profit 503.82 Total profit 643.12 Total loss -139.30
Profitability 4.62 Expected payoff 27.99
Absolute drawdown 8.70 Maximum drawdown 103.20 (7.77%) Relative drawdown 7.77% (103.20)
Total trades 18 Short positions (% win) 0 (0.00%) Long positions (% win) 18 (66.67%)
Profitable trades (% of all) 12 (66.67%) Loss trades (% of all) 6 (33.33%)
Largest profitable trade 107.32 losing transaction -43.00
Average profitable deal 53.59 losing trade -23.22
Maximum continuous wins (profit) 5 (263.10) Continuous losses (loss) 3 (-74.00)
Maximum Continuous Profit (number of wins) 263.10 (5) Continuous loss (number of losses) -74.00 (3)
Average continuous winnings 2 Continuous loss 2

Time Type Order Volume Price S / L T / P Profit Balance
1 2009.06.01 16:10 buy 1 0.10 1.63896 1.62396 0.00000
2 2009.06.01 17:55 close 1 0.10 1.64462 1.62396 0.00000 56.60 1056.60
3 2009.06.02 12:55 buy 2 0.10 1.64588 1.63088 0.00000
4 2009.06.02 14:05 close 2 0.10 1.64768 1.63088 0.00000 18.00 1074.60
5 2009.06.09 08:15 buy 3 0.10 1.60495 1.58995 0.00000
6 2009.06.09 09:00 close 3 0.10 1.61273 1.58995 0.00000 77.80 1152.40
7 2009.06.09 13:25 buy 4 0.10 1.61447 1.59947 0.00000
8 2009.06.09 14:00 close 4 0.10 1.61788 1.59947 0.00000 34.10 1186.50
9 2009.06.10 13:05 buy 5 0.10 1.63679 1.62179 0.00000
10 2009.06.10 13:35 close 5 0.10 1.64445 1.62179 0.00000 76.60 1263.10
11 2009.06.11 01:30 buy 6 0.10 1.63664 1.62164 0.00000
12 2009.06.11 02:00 close 6 0.10 1.63577 1.62164 0.00000 -8.70 1254.40
13 2009.06.11 15:45 buy 7 0.10 1.64653 1.63153 0.00000
14 2009.06.11 16:50 close 7 0.10 1.65300 1.63153 0.00000 64.70 1319.10
15 2009.06.12 17:15 buy 8 0.10 1.65102 1.63602 0.00000
16 2009.06.12 18:10 close 8 0.10 1.65011 1.63602 0.00000 -9.10 1310.00
17 2009.06.16 08:50 buy 9 0.10 1.63621 1.62121 0.00000
18 2009.06.16 09:00 close 9 0.10 1.63396 1.62121 0.00000 -22.50 1287.50
19 2009.06.16 17:05 buy 10 0.10 1.64623 1.63123 0.00000
20 2009.06.16 18:40 close 10 0.10 1.64199 1.63123 0.00000 -42.40 1245.10
21 2009.06.18 08:50 buy 11 0.10 1.64200 1.62700 0.00000
22 2009.06.18 09:30 close 11 0.10 1.64352 1.62700 0.00000 15.20 1260.30
23 2009.06.19 07:45 buy 12 0.10 1.63728 1.62228 0.00000
24 2009.06.19 11:50 close 12 0.10 1.64252 1.62228 0.00000 52.40 1312.70
25 2009.06.19 17:30 buy 13 0.10 1.64542 1.63042 0.00000
26 2009.06.19 18:10 close 13 0.10 1.65045 1.63042 0.00000 50.30 1363.00
27 2009.06.23 17:40 buy 14 0.10 1.63475 1.61975 0.00000
28 2009.06.24 02:40 close 14 0.10 1.64549 1.61975 0.00000 107.32 1470.32
29 2009.06.24 15:15 buy 15 0.10 1.65717 1.64217 0.00000
30 2009.06.24 15:35 close 15 0.10 1.65287 1.64217 0.00000 -43.00 1427.32
31 2009.06.26 08:50 buy 16 0.10 1.64036 1.62536 0.00000
32 2009.06.26 12:00 close 16 0.10 1.64922 1.62536 0.00000 88.60 1515.92
33 2009.06.29 12:15 buy 17 0.10 1.65490 1.63990 0.00000
34 2009.06.29 12:35 close 17 0.10 1.65354 1.63990 0.00000 -13.60 1502.32
35 2009.06.29 20:25 buy 18 0.10 1.65678 1.64178 0.00000
36 2009.06.29 21:25 close 18 0.10 1.65693 1.64178 0.00000 1.50 1503.82
 
Strategy Tester Report
ABC_exp
Alpari-Demo (Build 225)

Symbol GBPUSD (Great Britain Pound vs US Dollar)
Period 5 Minutes (M5) 2009.07.01 00:00 - 2009.07.31 22:59 (2009.07.01 - 2009.08.01)
Model By open prices (only for Expert Advisors with explicit bar opening control)
Parameters Lots=0.1; TrailingStop1=3110; StopLoss1=1500; TrailingStop2=3110; StopLoss2=1500; MAGIC_1=12345; MAGIC_2=23456; MA_Period=151; KFK=0.9;
Bars in history 7560 Modelled ticks 14120 Simulation quality n/a
Chart mismatch errors 0
Initial deposit 1000.00
Net profit 137.84 Total profit 239.34 Total loss -101.50
Profitability 2.36 Expected payoff 9.85
Absolute drawdown 24.16 Maximum drawdown 121.88 (11.10%) Relative drawdown 11.10% (121.88)
Total trades 14 Short positions (% win) 0 (0.00%) Long positions (% win) 14 (71.43%)
Profitable trades (% of all) 10 (71.43%) Loss trades (% of all) 4 (28.57%)
Largest profitable trade 58.00 losing transaction -57.20
Average profitable deal 23.93 Deal loss -25.38
Maximum number continuous wins (profit) 6 (82.92) Continuous losses (loss) 2 (-63.70)
Maximum Continuous Profit (number of wins) 117.12 (3) Continuous loss (number of losses) -63.70 (2)
Average continuous winnings 3 Continuous loss 1

Time Type Order Volume Price S / L T / P Profit Balance
1 2009.07.14 08:35 buy 1 0.10 1.62852 1.61352 0.00000
2 2009.07.14 08:40 close 1 0.10 1.62629 1.61352 0.00000 -22.30 977.70
3 2009.07.14 23:00 buy 2 0.10 1.63120 1.61620 0.00000
4 2009.07.15 02:30 close 2 0.10 1.63191 1.61620 0.00000 7.02 984.72
5 2009.07.15 13:35 buy 3 0.10 1.64028 1.62528 0.00000
6 2009.07.15 14:30 close 3 0.10 1.64286 1.62528 0.00000 25.80 1010.52
7 2009.07.16 12:45 buy 4 0.10 1.64466 1.62966 0.00000
8 2009.07.16 15:05 close 4 0.10 1.64481 1.62966 0.00000 1.50 1012.02
9 2009.07.20 03:35 buy 5 0.10 1.63951 1.62451 0.00000
10 2009.07.20 04:35 close 5 0.10 1.63994 1.62451 0.00000 4.30 1016.32
11 2009.07.20 18:45 buy 6 0.10 1.65356 1.63856 0.00000
12 2009.07.20 21:30 close 6 0.10 1.65368 1.63856 0.00000 1.20 1017.52
13 2009.07.22 16:55 buy 7 0.10 1.64327 1.62827 0.00000
14 2009.07.22 18:55 close 7 0.10 1.64758 1.62827 0.00000 43.10 1060.62
15 2009.07.23 08:30 buy 8 0.10 1.65223 1.63723 0.00000
16 2009.07.23 08:35 close 8 0.10 1.65068 1.63723 0.00000 -15.50 1045.12
17 2009.07.23 16:45 buy 9 0.10 1.65286 1.63786 0.00000
18 2009.07.23 17:35 close 9 0.10 1.65679 1.63786 0.00000 39.30 1084.42
19 2009.07.24 09:10 buy 10 0.10 1.65293 1.63793 0.00000
20 2009.07.24 10:35 close 10 0.10 1.64721 1.63793 0.00000 -57.20 1027.22
21 2009.07.27 08:35 buy 11 0.10 1.65044 1.63544 0.00000
22 2009.07.27 08:45 close 11 0.10 1.64979 1.63544 0.00000 -6.50 1020.72
23 2009.07.27 13:45 buy 12 0.10 1.65005 1.63505 0.00000
24 2009.07.28 09:45 close 12 0.10 1.65467 1.63505 0.00000 46.12 1066.84
25 2009.07.30 08:50 buy 13 0.10 1.64618 1.63118 0.00000
26 2009.07.30 09:30 close 13 0.10 1.64748 1.63118 0.00000 13.00 1079.84
27 2009.07.31 16:50 buy 14 0.10 1.65534 1.64034 0.00000
28 2009.07.31 17:15 close 14 0.10 1.66114 1.64034 0.00000 58.00 1137.84
Strategy Tester Report
ABC_exp
Alpari-Demo (Build 225)

Symbol GBPUSD (Great Britain Pound vs US Dollar)
Period 5 Minutes (M5) 2009.08.03 00:00 - 2009.08.11 23:59 (2009.08.02 - 2009.08.12)
Model By open prices (only for Expert Advisors with explicit bar opening control)
Parameters Lots=0.1; TrailingStop1=3110; StopLoss1=1500; TrailingStop2=3110; StopLoss2=1500; MAGIC_1=12345; MAGIC_2=23456; MA_Period=151; KFK=0.9;
Bars in history 3005 Simulated ticks 5007 Simulation quality n/a
Chart mismatch errors 0
Initial deposit 1000.00
Net profit 90.68 Total profit 146.52 Total loss -55.84
Profitability 2.62 Expected payoff 22.67
Absolute drawdown 4.30 Maximum drawdown 63.18 (5.68%) Relative drawdown 5.68% (63.18)
Total trades 4 Short positions (% win) 0 (0.00%) Long positions (% win) 4 (50.00%)
Profitable trades (% of all) 2 (50.00%) Loss trades (% of all) 2 (50.00%)
Largest profitable trade 92.80 losing deal -39.84
Average profitable deal 73.26 losing trade -27.92
Maximum number continuous wins (profit) 1 (92.80) Continuous losses (loss) 1 (-39.84)
Maximum Continuous Profit (number of wins) 92.80 (1) Continuous loss (number of losses) -39.84 (1)
Average continuous winnings 1 Continuous loss 1

Time Type Order Volume Price S / L T / P Profit Balance
1 2009.08.03 09:45 buy 1 0.10 1.67460 1.65960 0.00000
2 2009.08.03 10:50 close 1 0.10 1.68388 1.65960 0.00000 92.80 1092.80
3 2009.08.04 11:25 buy 2 0.10 1.69389 1.67889 0.00000
4 2009.08.04 14:45 close 2 0.10 1.69229 1.67889 0.00000 -16.00 1076.80
5 2009.08.04 19:50 buy 3 0.10 1.69312 1.67812 0.00000
6 2009.08.05 12:40 close 3 0.10 1.69850 1.67812 0.00000 53.72 1130.52
7 2009.08.05 18:45 buy 4 0.10 1.70146 1.68646 0.00000
8 2009.08.06 04:45 close 4 0.10 1.69750 1.68646 0.00000 -39.84 1090.68
 
If only the mql-code is involved in the EA, then something must be coded wrong, because with the opening price model 800 runs should not be so slow. Or maybe I misunderstood something. Usually experts with external binding such as neural network libraries, etc. are so slow. Of course, we can also assume that mql has a lot of nested loops (or calls of some "voracious" indicators) - then it may be completely slowed down. Therefore, I can only repeat the idea of the supposed need for refactoring ;-) - Re-check and re-transform some code fragments or the whole code.
 
marketeer писал(а) >>
If only mql-code is involved in Expert Advisor, something must be incorrectly coded there because 800 runs should not slow down at opening prices. Or am I misunderstanding something. Usually experts with external binding such as neural network libraries, etc. are so slow. Of course, we can also assume that mql has a lot of nested loops (or calls of some "voracious" indicators) - then it may be completely slowed down. Therefore, I can only repeat the idea of the supposed need for refactoring ;-) - Re-check and re-transform some code fragments or the whole code.

800 out of more than 8000 runs had passed by the time of writing the post, with 5 hours of optimization, and there was still 2 days to go. But I didn't wait until the end, reduced the enumeration range of some parameters, restarted and in 8 hours the whole optimization went through.

Best result:

     Прибыль     Всего сделок     Прибыльность   Матожидание     Просадка$    Просадка%
673  597.40         23            4.80            25.97           67.90         4.81%    Threshold1=109 Threshold2=227 USL=0.0037 MA_Period=58
 

The number of profitable trades exceeds the number of losing trades, the average profitable trade more than the losing one is a very good sign. In my opinion, you should not give up on this system, you should study its behaviour on a longer period. You can also put it on another cross.

Reason: