Skip to content

IIndicatorsAccessor.PriceOscillator

method · IIndicatorsAccessor · cAlgo.API.Internals

DesktopCLICloud

The Price Oscillator calculates the difference between two moving averages.

Definition

PriceOscillator PriceOscillator(DataSeries source, int longCycle, int shortCycle, MovingAverageType maType)
api.Indicators.PriceOscillator(source: DataSeries, longCycle: int, shortCycle: int, maType: MovingAverageType) -> PriceOscillator

Parameters

Name C# type Python type Description
source DataSeries DataSeries The price source data used for calculation.
longCycle int int The long period used for calculation.
shortCycle int int The short period used for calculation.
maType MovingAverageType MovingAverageType Type of the Moving Average.

Returns PriceOscillator — The Price Oscillator indicator instance.

Examples

var priceOscillator = Indicators.PriceOscillator(Bars.ClosePrices, 26, 12, MovingAverageType.Simple);
Print("Price Oscillator of the last closed bar: {0}", priceOscillator.Result.Last(1));
priceOscillator = api.Indicators.PriceOscillator(api.Bars.ClosePrices, 26, 12, MovingAverageType.Simple)
api.Print(f"Price Oscillator of the last closed bar: {priceOscillator.Result.Last(1)}")