Momentum |
Momentum measures the acceleration and deceleration of prices. It indicates if prices are increasing at an increasing rate or decreasing at a decreasing rate. The Momentum function can be applied to the price, or to any other data series.
As a market peaks, the Momentum indicator will climb sharply and then fall off — diverging from the continued upward or sideways movement of the price. Similarly, at a market bottom, Momentum will drop sharply and then begin to climb well ahead of prices. Both of these situations result in divergences between the indicator and prices.
To initialize Momentum indicator use one of the following constructors provided:
Momentum – sets default values: period = 14
Momentum(Int32) – sets values for period
Momentum(TimeSpan) – sets time period
Use
MomentumValue - property to get current value
1// Create new instance 2Momentum momentum = new Momentum(28); 3 4// Number of stored values 5momentum.HistoryCapacity = 2; 6 7// Add new data point 8momentum.Add(Bars.Current.Open, Bars.Current.High, Bars.Current.Low, Bars.Current.Close, Bars.Current.Volume); 9 10// Get indicator value 11double IndicatorValue = momentum.MomentumValue; 12// Get previous value 13if (momentum.HistoryCount == 2) 14{ 15 double IndicatorPrevValue = momentum[1]; 16}