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.031
Tracking Error
0.276
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# Custom Average Dollar Volume Indicator

import numpy as np

# -------------------------------------------------------------------
STOCKS = ['AAPL','MSFT','GOOGL', 'GOOG','AMZN','FB','QQQ']; SMA = 63;
# -------------------------------------------------------------------

class CustomIndicatorAlgorithm(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2020, 1, 1)  
        self.SetEndDate(2021, 8, 10)  
        self.SetCash(1000000)
        res = Resolution.Minute
        self.stocks = [self.AddEquity(ticker, Resolution.Minute).Symbol for ticker in STOCKS]
        self.adv = {}
        for sec in self.stocks:
            self.adv[sec] = AverageDollarVolume(SMA)
            self.RegisterIndicator(sec, self.adv[sec], Resolution.Daily)
        self.SetWarmUp(SMA, Resolution.Daily)
        self.Schedule.On(self.DateRules.EveryDay(self.stocks[0]), self.TimeRules.AfterMarketOpen(self.stocks[0], 61), 
            self.Indicator)

    def Indicator(self):
        if self.IsWarmingUp or not any(self.adv): return
    
        for sec in self.stocks:
            self.Plot("Indicator", sec, float(self.adv[sec].Value))
        
            
class AverageDollarVolume(PythonIndicator):  # Average Dollar Volume
    def __init__(self, SMA ):
        self.dv = np.array([])
        self.Value = 0
    
    def Update(self, input):
        dv = (input.Close * input.Volume)
        self.dv = np.append(self.dv, dv)[-SMA:]

        if len(self.dv) != SMA:
            return False
        
        self.Value = self.dv.mean()
        return True