Overall Statistics |
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return 11.925% Drawdown 13.000% Expectancy 0 Net Profit 0% Sharpe Ratio 0.823 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.002 Beta 0.998 Annual Standard Deviation 0.12 Annual Variance 0.014 Information Ratio 0.488 Tracking Error 0.004 Treynor Ratio 0.099 Total Fees $3.19 |
import clr import decimal clr.AddReference("System") clr.AddReference("QuantConnect.Algorithm") clr.AddReference("QuantConnect.Indicators") clr.AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * class BollingerBandsAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2013,10,07) #Set Start Date self.SetEndDate(2017,1,1) #Set End Date self.SetCash(100000) #Set Strategy Cash # Find more symbols here: http://quantconnect.com/data equity = self.AddSecurity(SecurityType.Equity, "SPY", Resolution.Daily) self.spy = equity.Symbol self.bb = self.BB(self.spy, 20, 2) def OnData(self, data): if not self.Portfolio.Invested: self.SetHoldings(self.spy, 1) def OnEndOfDay(self): self.Plot("BB", "MiddleBand", self.bb.MiddleBand.Current.Value) self.Plot("BB", "UpperBand", self.bb.UpperBand.Current.Value) self.Plot("BB", "LowerBand", self.bb.LowerBand.Current.Value)