Lean  $LEAN_TAG$
QuantConnect.Algorithm.Framework.Alphas.MacdAlphaModel Class Reference

Defines a custom alpha model that uses MACD crossovers. The MACD signal line is used to generate up/down insights if it's stronger than the bounce threshold. If the MACD signal is within the bounce threshold then a flat price insight is returned. More...

Inheritance diagram for QuantConnect.Algorithm.Framework.Alphas.MacdAlphaModel:
[legend]

Classes

class  SymbolData
 

Public Member Functions

 MacdAlphaModel (int fastPeriod=12, int slowPeriod=26, int signalPeriod=9, MovingAverageType movingAverageType=MovingAverageType.Exponential, Resolution resolution=Resolution.Daily)
 Initializes a new instance of the MacdAlphaModel class More...
 
override IEnumerable< InsightUpdate (QCAlgorithm algorithm, Slice data)
 Determines an insight for each security based on it's current MACD signal More...
 
override void OnSecuritiesChanged (QCAlgorithm algorithm, SecurityChanges changes)
 Event fired each time the we add/remove securities from the data feed. This initializes the MACD for each added security and cleans up the indicator for each removed security. More...
 
- Public Member Functions inherited from QuantConnect.Algorithm.Framework.Alphas.AlphaModel
 AlphaModel ()
 Initialize new AlphaModel More...
 

Protected Attributes

readonly Dictionary< Symbol, SymbolData_symbolData
 

Additional Inherited Members

- Properties inherited from QuantConnect.Algorithm.Framework.Alphas.AlphaModel
virtual string Name [get, set]
 Defines a name for a framework model More...
 
- Properties inherited from QuantConnect.Algorithm.Framework.Alphas.INamedModel
string Name [get]
 Defines a name for a framework model More...
 

Detailed Description

Defines a custom alpha model that uses MACD crossovers. The MACD signal line is used to generate up/down insights if it's stronger than the bounce threshold. If the MACD signal is within the bounce threshold then a flat price insight is returned.

Definition at line 31 of file MacdAlphaModel.cs.

Constructor & Destructor Documentation

◆ MacdAlphaModel()

QuantConnect.Algorithm.Framework.Alphas.MacdAlphaModel.MacdAlphaModel ( int  fastPeriod = 12,
int  slowPeriod = 26,
int  signalPeriod = 9,
MovingAverageType  movingAverageType = MovingAverageType.Exponential,
Resolution  resolution = Resolution.Daily 
)

Initializes a new instance of the MacdAlphaModel class

Parameters
fastPeriodThe MACD fast period
slowPeriodThe MACD slow period
signalPeriodThe smoothing period for the MACD signal
movingAverageTypeThe type of moving average to use in the MACD
resolutionThe resolution of data sent into the MACD indicator

Definition at line 50 of file MacdAlphaModel.cs.

Member Function Documentation

◆ Update()

override IEnumerable<Insight> QuantConnect.Algorithm.Framework.Alphas.MacdAlphaModel.Update ( QCAlgorithm  algorithm,
Slice  data 
)
virtual

Determines an insight for each security based on it's current MACD signal

Parameters
algorithmThe algorithm instance
dataThe new data available
Returns
The new insights generated

Reimplemented from QuantConnect.Algorithm.Framework.Alphas.AlphaModel.

Definition at line 73 of file MacdAlphaModel.cs.

Here is the call graph for this function:

◆ OnSecuritiesChanged()

override void QuantConnect.Algorithm.Framework.Alphas.MacdAlphaModel.OnSecuritiesChanged ( QCAlgorithm  algorithm,
SecurityChanges  changes 
)
virtual

Event fired each time the we add/remove securities from the data feed. This initializes the MACD for each added security and cleans up the indicator for each removed security.

Parameters
algorithmThe algorithm instance that experienced the change in securities
changesThe security additions and removals from the algorithm

Reimplemented from QuantConnect.Algorithm.Framework.Alphas.AlphaModel.

Definition at line 121 of file MacdAlphaModel.cs.


The documentation for this class was generated from the following file: