Price Oscillator |
The variation between security price moving averages gives the Price Oscillator. It can be expressed in percents as well as in points showing the difference between any averages.
The PO Indicator is a difference between the moving averages, built on the basis of two periods:
where - moving average of the P price within n periods.
To initialize indicator, use one of the following constructors:
PriceOscillator – set default values: fastPeriod = 7, slowPeriod = 14
PriceOscillator(Int32, Int32, Boolean) – set value for period
PriceOscillator(TimeSpan, TimeSpan, Boolean) – sets time period
Use
OscillatorValue - property to get current value
TradeSignal - property to get indicator trading signal
1// Create new instance 2var indicator = new PriceOscillator(14, 28); 3 4// Number of stored values 5indicator.HistoryCapacity = 2; 6 7// Add new data point 8indicator.Add(CurrentPrice); 9 10// Get indicator value 11double IndicatorValue = indicator.OscillatorValue; 12// Get previous value 13if (indicator.HistoryCount == 2) 14{ 15 double IndicatorPrevValue = indicator[1]; 16}