RecoveryFactor

Author: Mark Fric

May 27th, 2020

Rating:
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

as requested here: https://roadmap.strategyquant.com/tasks/sq4_6339

The code is very simple:

package SQ.Columns.Databanks;

import com.strategyquant.lib.L;
import com.strategyquant.lib.SettingsMap;
import com.strategyquant.tradinglib.DatabankColumn;
import com.strategyquant.tradinglib.OrdersList;
import com.strategyquant.tradinglib.SQStats;
import com.strategyquant.tradinglib.StatsTypeCombination;
import com.strategyquant.tradinglib.ValueTypes;

public class RecoveryFactor extends DatabankColumn {
    
    public RecoveryFactor() {
        super(L.t("RecoveryFactor"), DatabankColumn.Decimal2, ValueTypes.Maximize, 0, 0, 200);
        
        setDependencies("NetProfit", "DrawdownPct");
    }
    
    //------------------------------------------------------------------------

    @Override
    public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception {
        int netProfit = stats.getInt("NetProfit");
        int drawdownPct = stats.getInt("DrawdownPct");
        
        return round2(safeDivide(netProfit, drawdownPct));
    }
}

 

 

0 Comments
Inline Feedbacks
View all comments