Overall Statistics
Total Trades
6
Average Win
14.75%
Average Loss
-0.38%
Compounding Annual Return
17.899%
Drawdown
18.600%
Expectancy
18.772
Net Profit
38.981%
Sharpe Ratio
0.996
Probabilistic Sharpe Ratio
49.784%
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
38.54
Alpha
0.107
Beta
1.01
Annual Standard Deviation
0.182
Annual Variance
0.033
Information Ratio
0.978
Tracking Error
0.11
Treynor Ratio
0.179
Total Fees
$14.51
class OptimizedResistanceCoil(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2015, 1, 1)
        self.SetEndDate(2017, 1, 1)

        # we do not want to rebalance on insight changes
        self.Settings.RebalancePortfolioOnInsightChanges = False;
        # we want to rebalance only on security changes
        self.Settings.RebalancePortfolioOnSecurityChanges = True;
        
        self.SetUniverseSelection(CustomUniverseSelectionModel("CustomUniverseSelectionModel", self.CustomSelection))
        self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromMinutes(20), 0.025, None));
        # By sending in a rebalancing function which returns None we ensure that rebalancing will not happen due to period being up
        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(lambda time: None))
        self.SetExecution(ImmediateExecutionModel())
        
    def CustomSelection(self, time):
        if time.year == 2015:
            return [ "FB", "SPY" ]
        return [ "AAPL", "IBM" ]
        
    def OnOrderEvent(self, orderEvent):
        self.Log(str(orderEvent))