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.412 Tracking Error 0.205 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
from AlgorithmImports import * class HipsterFluorescentPinkRabbit(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 1, 5) self.SetEndDate(2023,3,5) self.SetCash(100000) spy = self.AddEquity("SPY", Resolution.Daily, dataNormalizationMode=DataNormalizationMode.SplitAdjusted) self.spy = spy.Symbol self.ema8 = self.EMA(self.spy, 8, Resolution.Daily) self.sma200 = self.SMA(self.spy, 200, Resolution.Daily) def OnData(self, data): if data.Bars.ContainsKey("SPY"): spyTradeBar = data.Bars['SPY'] spyClose = spyTradeBar.Close self.Log(f"SPY={spyTradeBar.Close}") if self.ema8.IsReady and self.sma200.IsReady: emaVal = round(self.ema8.Current.Value, 2) smaVal = round(self.sma200.Current.Value, 2) self.Log(f"SMA is {str(smaVal)}")