Hi,

I am trying a really basic MACD Alpha model using the algo framework and I see some errors in insights time compared to Yahoo finance or spreadsheet calculated MACD. Maybe I am just beginning and missing something really obvious, can you help me to make it work ?

 

I checked that Resolution was daily for both Alpha model and Yahoo finance.

I tried both MovingAverageType.Simple and MovingAverageType.Exponential in addAlpha arguments.

Example of insights

https://drive.google.com/file/d/16qplL_BKu9bWZ3O3Uy30-f-n_VoTmY-8/view?usp=sharing

Example of yahoo finance MACD

https://drive.google.com/file/d/16qplL_BKu9bWZ3O3Uy30-f-n_VoTmY-8/view?usp=sharing

 

from Alphas.MacdAlphaModel import MacdAlphaModel class PrototypeV0(QCAlgorithm): def Initialize(self): self.UniverseSettings.Resolution = Resolution.Minute self.UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw self.SetStartDate(2017, 2, 15) self.SetCash(100000) symbols = [ Symbol.Create("TSLA", SecurityType.Equity, Market.USA)] self.AddAlpha(MacdAlphaModel(12, 26, 9, MovingAverageType.Exponential, Resolution.Daily)) self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel() ) self.SetExecution( ImmediateExecutionModel() ) self.SetRiskManagement(TrailingStopRiskManagementModel(0.05)) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' # if not self.Portfolio.Invested: # self.SetHoldings("SPY", 1)