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)
        
        symbol = self.AddEquity("NOW", Resolution.Minute).Symbol
        strat= Strategy(qcalgo=self, symbol=symbol)
        self.Schedule.On(self.DateRules.EveryDay(symbol), self.TimeRules.BeforeMarketClose(symbol, 2), strat.buy)
        

class Strategy:
    def __init__(self, qcalgo, symbol):
        self.algo = qcalgo  # self - QCAlgorithm
        self.symbol = symbol
    
    def buy(self):
        if not self.algo.CurrentSlice.ContainsKey(self.symbol) or self.algo.Portfolio[self.symbol].Invested: return
        
        history = self.algo.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[self.algo.CurrentSlice[self.symbol].EndTime] = [self.algo.CurrentSlice[self.symbol].Close]