Fitness calculation appears inconsistent with custom weightings

When using custom weighting for fitness scoring, it appears that it is using variables outside of the scope selected, leading to inaccurate fitness scores.



In the attached screenshots you can see that I have only selected one (custom) databank column "TTHFitness" which always returns a static value of 0.5. There is no logic to it, I only created it to test this.

public class TTHFitness extends DatabankColumn {
    
  public TTHFitness() {
    super("TTHFitness", 
          DatabankColumn.Decimal2, // value display format
          ValueTypes.Maximize, // whether value should be maximized / minimized / approximated to a value   
          0, // target value if approximation was chosen  
          0, // average minimum of this value
          1); // average maximum of this value
    
    setWidth(80); // defaultcolumn width in pixels
    
    setTooltip("Your tooltip here");  
    
  @Override
  public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {
    return 0.5;
  } 
}



In the screenshot showing a sample set of strategies, you can see that the TTHFitess is always returning 0.5 as expected. However, the Fitness column is calculating values that deviate from 0.5, and they seem to be correlated with a higher net profit (or profit factor, ret/dd). This should not happen!


I understand that SQX is using multipliers to lower the Fitness scoring when trades are < 150 (I have seen this in another comment by Mark), but these Fitness values don't align with this, so I have no idea how it is calculating them.


If I tell SQX to calculate a Fitness score using column X, then this should be the only thing used. I do not want/need SQX to try and supplement the Fitness scoring with unknown variables as it interferes my workflow.


Please inform us how Fitness is calculated. I haven't provided strategy or configuration files since it's very easy to reproduce the problem. It will apply to all configurations and all strategies.




* EDIT: See the attached screenshot "variable input" where you can see that whilst the "TTHFitness" column is select as the only input for the custom weighting, I set the value of TTHFitness to the value of stagnation (so the value is now not only 0.5, but a value in the hundreds, variable). The Fitness score is still sorted by Profit Factor with the TTHFitness value seemingly ignored.

Attachments
fitness weighting.png
(42.09 KiB)
showcase incorrect fitness.png
(50.43 KiB)
  • Votes +7
  • Project StrategyQuant X
  • Type Bug
  • Status Waiting for information
  • Priority Normal
  • Assignee Mark Fric
  • Milestone Build 136

History

SS
#1

Stormin_Norman2

15.09.2021 14:44

Task created

SS
#2

Stormin_Norman2

15.09.2021 14:45
Voted for this task.
IH
#3

clonex

15.09.2021 14:54
Voted for this task.
SS
#4

Stormin_Norman2

15.09.2021 15:02
After closer inspection, it appears as though the Profit Factor aligns with Fitness, at least in these tests I'm running. Is Profit Factor used within the fitness function?
SS
#5

Stormin_Norman2

15.09.2021 15:44

Description changed:

When using custom weighting for fitness scoring, it appears that it is using variables outside of the scope selected, leading to inaccurate fitness scores.



In the attached screenshots you can see that I have only selected one (custom) databank column "TTHFitness" which always returns a static value of 0.5. There is no logic to it, I only created it to test this.

public class TTHFitness extends DatabankColumn {
    
  public TTHFitness() {
    super("TTHFitness", 
          DatabankColumn.Decimal2, // value display format
          ValueTypes.Maximize, // whether value should be maximized / minimized / approximated to a value   
          0, // target value if approximation was chosen  
          0, // average minimum of this value
          1); // average maximum of this value
    
    setWidth(80); // defaultcolumn width in pixels
    
    setTooltip("Your tooltip here");  
    
  @Override
  public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {
    return 0.5;
  } 
}



In the screenshot showing a sample set of strategies, you can see that the TTHFitess is always returning 0.5 as expected. However, the Fitness column is calculating values that deviate from 0.5, and they seem to be correlated with a higher net profit (or profit factor, ret/dd). This should not happen!


I understand that SQX is using multipliers to lower the Fitness scoring when trades are < 150 (I have seen this in another comment by Mark), but these Fitness values don't align with this, so I have no idea how it is calculating them.


If I tell SQX to calculate a Fitness score using column X, then this should be the only thing used. I do not want/need SQX to try and supplement the Fitness scoring with unknown variables as it interferes my workflow.


Please inform us how Fitness is calculated. I haven't provided strategy or configuration files since it's very easy to reproduce the problem. It will apply to all configurations and all strategies.



* EDIT: See the attached screenshot "variable input" where you can see that whilst the "TTHFitness" column is select as the only input for the custom weighting, I set the value of TTHFitness to the value of stagnation (so the value is now not only 0.5, but a value in the hundreds, variable). The Fitness score is still sorted by Profit Factor with the TTHFitness value seemingly ignored.

Attachment variable input.png added

variable input.png
(67.85 KiB)
SF
#6

sebasfiorent

15.09.2021 15:50
Voted for this task.
b
#7

bentra

15.09.2021 15:54
Voted for this task.
SS
#8

Stormin_Norman2

15.09.2021 16:09
Task can be closed. Turns out SQX was not saving the Fitness function changes. I recreated a new project and the fitness function was working as expected (although this is a bug).
IN
#9

altenburg90

18.09.2021 13:34
Voted for this task.
MF
#10

Mark Fric

23.09.2021 11:14

Assignee changed from Mark Fric to Mark Fric

Status changed from New to In progress

Milestone changed from None to Build 136

MF
#11

Mark Fric

23.09.2021 11:28

Status changed from In progress to Waiting for information

I checked it and as you say, there is no error in itness funciton. The only coefficient that s used for fitness computation is when there is less than 150 trades, and it is 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;
}


> Turns out SQX was not saving the Fitness function changes.


can you please describe more in detail what you mean? We will fix it, but I don't know what doesn't work from your description.

E
#12

Emmanuel

27.09.2021 16:42
Voted for this task.
HH
#13

Hans

27.09.2021 23:58
Voted for this task.

Votes: +7

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please