Optimizer Unable to Find Global Maximum on Parameters and Giving Inconsistent Values Everytime

I'm using the strategy attached.

Let's say I want to find the parameters that give the maximum Net Profit on the Optimizer.

These are the initial values for optimization on two variables: https://i.imgur.com/sxX92N3.png
But as you could see, it couldn't find the global maximum on net profit: https://i.imgur.com/M1x1Wmx.png
So, I've tried to narrow the parameters: https://i.imgur.com/RIyLgzn.png
But again is unable to find the global maximum on net profit: https://i.imgur.com/WyzOVn4.png
So, I've tried to narrow the parameters for the third time: https://i.imgur.com/dwcKFEi.png
And finally it found the global maximum: https://i.imgur.com/3cpwguH.png


So everytime I have to optimize parameters based on some metric, I have to see 3D Optimization Chart to narrow the parameters manually and find the global maximum.

It could be nice if it could be done automatically.


What happen if I try to optimize three variables at the same time? It couldn't find a better net profit than the original strat: https://i.imgur.com/FM7UAZD.png
Later on, I closed and opened sqx and it gave another result: https://i.imgur.com/oGvUkmN.png
And I did it again, giving another result: https://i.imgur.com/hBtsXf8.png


In the case of more than two variables, I have to optimize two variables at a time, narrow down the parameters and later on optimize another two variables and narrow down the parameters again in order to find the right value.
























Attachments
Test 3 3.sqx
(808.31 KiB)
  • Votes +3
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

CG
#1

Chris G

21.05.2021 01:12

Task created

CG
#2

Chris G

21.05.2021 01:12
Voted for this task.
AA
#3

AngelDuz

21.05.2021 02:39
Voted for this task.
RR
#4

ROEye

21.05.2021 03:36
Check if it finds the correct optimum peak by checking Fitness over Net Profit.
NS
#5

nicksim80

21.05.2021 05:26
Voted for this task.
MF
#6

Mark Fric

21.05.2021 13:36

Status changed from New to Fixed

it works correctly, but there is a special handling when computing fitness - the fitness is decreased by some coefficient if the number of trades is lower than some boundary.


The idea is that backtests with low number of trades have also lower fitness.


So SQ correctly optimizes the results but by fitness.


There is one more bug in v131 that Fitness is not shown in the 3D chart, I fixed it.


The coefficients are as follows:

if(trades < 20) {

fitness *= 0.3;

} else if(trades < 30) {

fitness *= 0.4;

} else if(trades < 50) {

fitness *= 0.6;

} else if(trades < 70) {

fitness *= 0.8;

} else if(trades < 100) {

fitness *= 0.85;

} else if(trades < 150) {

fitness *= 0.9;

}

CG
#7

Chris G

21.05.2021 15:09
If I choose some metric like Net Profit or Profit Factor, Could SQ still optimize using that metric?

Because I had to narrow down parameters manually, in order to make the optimization work.

MF
#8

Mark Fric

24.05.2021 08:08
I don't understand what you mean. Whatever metric you choose is transformed to fitness, and there is this coefficient for small number of trades used.


There's no way to avoid this, and it is intentional. With small number of trades the statistical significance is small.


Votes: +3

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please