Overall Statistics
Total Trades
199
Average Win
1.17%
Average Loss
-0.55%
Compounding Annual Return
-5.003%
Drawdown
23.600%
Expectancy
-0.204
Net Profit
-14.246%
Sharpe Ratio
-0.248
Probabilistic Sharpe Ratio
0.541%
Loss Rate
75%
Win Rate
25%
Profit-Loss Ratio
2.13
Alpha
-0.023
Beta
-0.062
Annual Standard Deviation
0.115
Annual Variance
0.013
Information Ratio
-0.704
Tracking Error
0.158
Treynor Ratio
0.462
Total Fees
$707.42
Estimated Strategy Capacity
$71000000.00
Lowest Capacity Asset
MSFT R735QTJ8XC9X
from Alphas.EmaCrossAlphaModel import EmaCrossAlphaModel
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.MeanVarianceOptimizationPortfolioConstructionModel import MeanVarianceOptimizationPortfolioConstructionModel
from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity
from Selection.QC500UniverseSelectionModel import QC500UniverseSelectionModel

class RetrospectiveBlackBuffalo(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2015, 1, 2)  # Set Start Date
        self.SetEndDate(2017, 12, 29)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.AddEquity("MSFT", Resolution.Daily)
        self.AddAlpha(RsiAlphaModel(period = 14,
                 resolution = Resolution.Daily))
        self.AddAlpha(MacdAlphaModel( fastPeriod = 12,
                 slowPeriod = 26,
                 signalPeriod = 9,
                movingAverageType = MovingAverageType.Exponential,
                resolution = Resolution.Daily))
                 

        self.SetExecution(ImmediateExecutionModel())

        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(rebalance = Resolution.Daily
        , portfolioBias = PortfolioBias.Long))
        
        self.Settings.MinAbsolutePortfolioTargetPercentage=0.0
        
        

        #self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.10))

        #self.SetUniverseSelection(SP500SectorsETFUniverse())


    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''

        # if not self.Portfolio.Invested:
        #    self.SetHoldings("SPY", 1)