| 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 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class Algo(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 8, 9)
self.SetCash(10000)
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage)
self.symbol = self.AddEquity("NOW").Symbol
self.canTrade = False
self.Schedule.On(
self.DateRules.EveryDay(self.symbol),
self.TimeRules.BeforeMarketClose(self.symbol, 2),
self.SetCanTrade)
def SetCanTrade(self):
self.canTrade = True
def OnData(self, slice):
if not(self.canTrade and self.symbol in slice.Bars):
return
self.canTrade = False
bar = slice.Bars[self.symbol]
if self.Portfolio[self.symbol].Invested:
return
history = self.History(self.symbol, 3, Resolution.Daily)
if 'close' not in history or history.dropna().shape[0] < 2: return
close, open_, low, high, volume = history.close.unstack(level=0), history.open.unstack(level=0), history.low.unstack(level=0), history.high.unstack(level=0), history.volume.unstack(level=0)
close.loc[bar.EndTime] = [bar.Close]