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.914
Tracking Error
0.25
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# five day sma of logr vol
import numpy as np

class VAlgorithm(QCAlgorithmFramework):

    def Initialize(self):
        self.SetStartDate(2020, 1, 1)
        # self.SetEndDate(2021, 3, 1)
        self.spy = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.lookbackSTD = 30  
        self.lookbackSMA = 5   
        self.SetWarmup(self.lookbackSTD + self.lookbackSMA, Resolution.Daily)
        self.logr = self.LOGR(self.spy, 1)
        self.std = IndicatorExtensions.Of(StandardDeviation(self.lookbackSTD), self.logr)
        self.stdAvg = IndicatorExtensions.SMA(self.std, self.lookbackSMA)


    def OnEndOfDay(self):
        if self.IsWarmingUp or not self.stdAvg.IsReady: return

        vol = float(self.std.Current.Value*np.sqrt(252))
        volAvg = float(self.stdAvg.Current.Value*np.sqrt(252))

        self.Plot("Indicators", "Vol", vol)
        self.Plot("Indicators", "Vol_Avg", volAvg)