Overall Statistics |
Total Trades 6 Average Win 0% Average Loss 0% Compounding Annual Return 0.007% Drawdown 0.000% Expectancy 0 Net Profit 0% Sharpe Ratio 0.285 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.001 Beta 0.001 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -8.711 Tracking Error 0.086 Treynor Ratio 0.049 Total Fees $6.00 |
from QuantConnect.Data.Market import TradeBar from QuantConnect import Securities class testyou(QCAlgorithm): def Initialize(self): # Set the cash we'd like to use for our backtest # This is ignored in live trading self.SetCash(100000) # Start and end dates for the backtest. # These are ignored in live trading. self.SetStartDate(2012,1,1) self.SetEndDate(2012,1,11) self.sym="SPY" # Add assets you'd like to see self.spy = self.AddEquity(self.sym, Resolution.Daily).Symbol # for Alex code for tick values.. to use minimum tick values need to remove .Symbol # ROR.. self.count = 0 # My counter self.rWindow = RollingWindow[TradeBar](2) # Rolling window (yesterday value) # Symbol properties.. #self.p = self.spy.SymbolProperties.MinimumPriceVariation def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.''' self.Log(">>> OnData called..") #self.Log("tick size = " + str(self.p)) # Add SPY TradeBar in rollling window self.rWindow.Add(data[self.sym]) bar = data[self.sym] # Place open and close orders.. self.MarketOnOpenOrder(self.sym, 1, "hello") self.MarketOnCloseOrder(self.sym, -1, "goodbye") self.Log("OnData exited >>>") self.Log(" ")