Overall Statistics |
Total Trades 53 Average Win 1.31% Average Loss -0.45% Compounding Annual Return 585.527% Drawdown 5.700% Expectancy 0.622 Net Profit 16.937% Sharpe Ratio 8.536 Probabilistic Sharpe Ratio 88.030% Loss Rate 59% Win Rate 41% Profit-Loss Ratio 2.93 Alpha 3.012 Beta -0.625 Annual Standard Deviation 0.369 Annual Variance 0.136 Information Ratio 7.949 Tracking Error 0.424 Treynor Ratio -5.04 Total Fees $1387.37 Estimated Strategy Capacity $14000000.00 Lowest Capacity Asset AAPL R735QTJ8XC9X |
# Deviations QC Indicators from AlgorithmImports import * # --------------------------------------------------- STOCK = "AAPL"; PERIOD = 100; NUM_DEVIATIONS = 0.025; # --------------------------------------------------- class DeviationsAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2015,1,1) self.SetEndDate(2015,2,1) self.SetCash(100000) res = Resolution.Minute self.stock = self.AddEquity(STOCK, res).Symbol open = self.Identity(self.stock, res, Field.Open) close = self.Identity(self.stock, res, Field.Close) prev_close = IndicatorExtensions.Of(Delay(1), close) volatility = self.STD(self.stock, PERIOD, res) delta = IndicatorExtensions.Minus(open, prev_close) self.deviations = IndicatorExtensions.Over(delta, volatility) self.SetWarmUp(PERIOD, res) def OnData(self, data): if self.IsWarmingUp: return if not self.deviations.IsReady: return if not self.Time.minute == 31: return dev = self.deviations.Current.Value self.Plot(self.stock, "deviations", dev) self.Plot(self.stock, "LB", -NUM_DEVIATIONS) self.Plot(self.stock, "UB", NUM_DEVIATIONS) if dev < -NUM_DEVIATIONS: self.SetHoldings(self.stock, 1) elif dev > NUM_DEVIATIONS: self.SetHoldings(self.stock, -1)