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.15
Tracking Error
0.407
Treynor Ratio
0
Total Fees
$0.00
from statistics import pstdev
class NadionTachyonReplicator(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019, 12, 17)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.AddEquity("SPY", Resolution.Daily)
        self.ad = self.AD("SPY", Resolution.Daily)
        self.ad_values = []
        self.ad_stddev = StandardDeviation(20)
        
        self.ad.Updated += self.OnAdUpdated
        
    def OnAdUpdated(self, ad, current):
        if ad.IsReady:
            self.ad_stddev.Update(current.EndTime, current.Value)
            self.ad_values.append(self.ad.Current.Value)
            self.Plot('AD', 'EOD', self.ad.Current.Value)
            self.Plot('STD', 'EOD', self.ad_stddev.Current.Value)
            self.Plot('STD ALT', 'EOD', pstdev(self.ad_values[-20:]))