| 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 -0.751 Tracking Error 0.334 Treynor Ratio 0 Total Fees $0.00 |
class Testbars(QCAlgorithm):
# Set parameters
# Backtest Portfolio Parameters
cash = 100000
startyyyy, startm, startd = 2020, 1, 1
endyyyy, endm, endd = 2021, 1, 1
secticker = "TSLA"
def Initialize(self):
# # self.SetBenchmark(self.secticker)
# self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)
self.SetStartDate(self.startyyyy, self.startm, self.startd) # Set Start Date
self.SetEndDate(self.endyyyy, self.endm, self.endd) # Set End Date
self.SetCash(self.cash) # Set Strategy Cash
self.sec = self.AddEquity(self.secticker, Resolution.Hour) # Set security
self.symbol= self.sec.Symbol # Set symbol
self.lookback = 30 # Set number of days to look back
#Logic starts here
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 data.Bars.ContainsKey(self.secticker):
bar = data.Bars[self.secticker] # Get bar for security
if self.Time.month == 1 and 8 < self.Time.day < 11:
self.Debug(f" bar time {bar.EndTime} OHLC {bar.Open, bar.High, bar.Low, bar.Close}")