Portfolio Master Fitness Function
4 replies
Marcello Vieira
6 years ago #256134
Hi, I want to change the fitness function for portfolio master.
In the Monte Carlo Sim I want to add more simulations, and I want to optimize Ret/DD instead of netprofit.
C:\QuantAnalyzer4\extend\Snippets\com\strategyquant\extend\FitnessFunctions\MonteCarloSim.Java
I edited this file, but nothing happened.
Then just to test If I was editing the right file I did this:
public synchronized double computeFitness(SQResultsGroup resultsGroup, String sampleType) throws Exception { return 1; }
And still, nothing changed. Portfolio Master was running just fine as if I havent changed nothing.
What do I have to do for chages in the code to be effective? Every time I close QuantAnalyzer and open again to test.
0
Tomas Matejka
6 years ago #256144
Hello,
did you compile the file after editing?
0
Marcello Vieira
6 years ago #256159
Yes, I did compile and restarted QA.
I could make it to do something. Instead of editing MonteCarloSim.java, I created a new file CustomMonteCarloSim.java and then my changes were there.
What is blocking me now is that I cannot find documentation on the functions. I do not know whant functions are available and what are the parameters and types.
Where can I find documentation?
Instead of getting the montecarlo for NetProfit, I want to opmize based on Return to DD ratio. So I did this:
ConfidenceLevelResults confidenceLevelResults = (ConfidenceLevelResults) Program.get(“MonteCarloConfidenceLevels”).call(“run”, settings);
MonteCarloStatValues result = confidenceLevelResults.get(90);
return result.getDouble(MCStatsConst.RET_DD_RATIO);
But this seems to always return 0. Because that is waht is printed besides each portfolio that is created. It always print the fitness function result besides the portfolio, I only get zero with this code.
0
Tamas
6 years ago #256181
Predefined snippets cannot be changed. The correct way is to create a custom snippet as you did.
It returns 0 because there is a bug in snippet MCRetDDRatio (it should be calculated from MCStatsConst.MAX_DD, MCStatsConst.NET_PROFIT instead of PCT_NET_PROFIT. It will be fixed in the next release).
Please use the attached snippet where RetDDRatio is computed right in the MC fitness.
0
Tamas
6 years ago #256183
Here is a link to api doc https://strategyquant.com/qa_api/
0
Viewing 4 replies - 1 through 4 (of 4 total)