Not logged in
Viewing 2 posts - 1 through 2 (of 2 total)
  • #113587|
    Customer
    484 Posts

    My plagiarized fitness code compiles and works except it does not display a fitness value (all 0.0).

     

    Can you see where I’ve gone wrong?

     

     

    /*
     * Copyright (c) 2015, StrategyQuant – All rights reserved.
     *
     * Code in this file was made in a good faith that it is correct and does what it should. 
     * If you found a bug in this code OR you have an improvement suggestion OR you want to include 
     * your own code snippet into our standard library please contact us at:
     *
     * This code can be used only within StrategyQuant products. 
     * Every owner of valid (free, trial or commercial) license of any StrategyQuant product 
     * is allowed to freely use, copy, modify or make derivative work of this code without limitations,
     * to be used in all StrategyQuant products and share his/her modifications or derivative work 
     * with the StrategyQuant community.
     *  
     * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
     * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
     * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES 
     * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     *  
     */
    package com.strategyquant.extend.FitnessFunctions;
     
    import com.strategyquant.lib.fitness.FitnessFunction;
    import com.strategyquant.lib.results.SQResultsGroup;
    import com.strategyquant.lib.results.SQStats;
    import com.strategyquant.lib.utils.SQConst;
    import com.strategyquant.lib.utils.SQUtils;
     
    public class Stability extends FitnessFunction {
     
    public Stability() {
    super();
     
    name = “Stability”;
    type = FitnessFunction.MAXIMIZE;
    }
     
    @Override
    public double computeFitness(SQResultsGroup resultsGroup) throws Exception {
          return resultsGroup.getResult(SQConst.SYMBOL_PORTFOLIO).getStats(SQConst.DIRECTION_ALL, SQConst.PL_IN_MONEY, SQConst.KEY_SAMPLE_ALL).getDouble(“Stability”);
    }
     
    @Override
    public String printFitness(SQResultsGroup resultsGroup) throws Exception {
    double fitness = computeFitness(resultsGroup);
     
    return SQUtils.d2(fitness);
    }
     
     
    }
     
    #129858
    Administrator
    1776 Posts

    I’m glad there is somebody who is trying to use QuantEditor.

     

    I looked at this, I assume you tried to use this new Fitness value in Portfolio Master, right?

     

    The problem there is that this fitness value is used, but it is not assigned to the final strategy, I’ll fix that in the new update.

    Mark
    StrategyQuant architect

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.