| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -1.138 Tracking Error 0.161 Treynor Ratio 0 Total Fees $0.00 |
from datetime import datetime,timedelta
class ParticleNadionChamber(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2015, 1, 13) # Set Start Date
self.SetEndDate(datetime.now()-timedelta(days = 1))
self.SetCash(1000000) # Set Strategy Cash
#Adding the symbols for the portfolio
self.symbolList = ["AAPL"]
#self.symbolList = ["GOOG", "GOOGL"]
#GOOG is an issue
self.allocation = round(1/len(self.symbolList),2)
self.daily = {}
# list of symbol objects
self.SecuritySymbols = []
for name in self.symbolList:
# get symbol object
symbol = self.AddEquity(name, Resolution.Hour, Market.USA).Symbol
# append to list
self.SecuritySymbols.append(symbol)
self.daily[symbol] = RollingWindow[float](2)
self.SetWarmup(200)
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
'''
for symbol in self.SecuritySymbols:
if data.ContainsKey(symbol):
#data.ContainsKey("EURUSD")
#self.Debug("{}".format(symbol))
# get OHLC values to use later
# o = data.Bars[symbol].Open
# h = data.Bars[symbol].High
# l = data.Bars[symbol].Low
c = data.Bars[symbol].Close
# update our rolling window
self.daily[symbol].Add(c)
# check if rolling window is full
if not (self.daily[symbol].IsReady): return
prev_hour_price = self.daily[symbol][1]
current_bar_close = self.daily[symbol][0]
else: pass