IIndicatorsAccessor.StochasticOscillator
method · IIndicatorsAccessor · cAlgo.API.Internals
The Stochastic Oscillator is a momentum indicator that aims to show price reversals by comparing the closing price to the price range.
Overloads
StochasticOscillator(int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType)
The Stochastic Oscillator is a momentum indicator that aims to show price reversals by comparing the closing price to the price range.
StochasticOscillator StochasticOscillator(int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType)
api.Indicators.StochasticOscillator(kPeriods: int, kSlowing: int, dPeriods: int, maType: MovingAverageType) -> StochasticOscillator
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
kPeriods | int | int | The value of the k periods used for calculation. |
kSlowing | int | int | The value of the k slowing used for calculation. |
dPeriods | int | int | The value of the d periods used for calculation. |
maType | MovingAverageType | MovingAverageType | Type of the Moving Average. |
Returns StochasticOscillator — Stochastic Oscillator indicator instance.
Examples
var stochastic = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
if (stochastic.PercentK.LastValue < 20)
Print("Stochastic %K is oversold: {0}, %D: {1}", stochastic.PercentK.LastValue, stochastic.PercentD.LastValue);
stochastic = api.Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple)
if stochastic.PercentK.LastValue < 20:
api.Print(f"Stochastic %K is oversold: {stochastic.PercentK.LastValue}, %D: {stochastic.PercentD.LastValue}")
StochasticOscillator(int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType, StochasticCalculationType calculationType)
The Stochastic Oscillator is a momentum indicator that aims to show price reversals by comparing the closing price to the price range.
StochasticOscillator StochasticOscillator(int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType, StochasticCalculationType calculationType)
api.Indicators.StochasticOscillator(kPeriods: int, kSlowing: int, dPeriods: int, maType: MovingAverageType, calculationType: StochasticCalculationType) -> StochasticOscillator
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
kPeriods | int | int | The value of the k periods used for calculation. |
kSlowing | int | int | The value of the k slowing used for calculation. |
dPeriods | int | int | The value of the d periods used for calculation. |
maType | MovingAverageType | MovingAverageType | Type of the Moving Average. |
calculationType | StochasticCalculationType | StochasticCalculationType | Type of calculation. |
Returns StochasticOscillator — Stochastic Oscillator indicator instance.
Examples
var stochastic = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple, StochasticCalculationType.CloseClose);
Print("Stochastic (close/close) %K: {0}, %D: {1}", stochastic.PercentK.LastValue, stochastic.PercentD.LastValue);
stochastic = api.Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple, StochasticCalculationType.CloseClose)
api.Print(f"Stochastic (close/close) %K: {stochastic.PercentK.LastValue}, %D: {stochastic.PercentD.LastValue}")
StochasticOscillator(Bars bars, int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType)
The Stochastic Oscillator is a momentum indicator that aims to show price reversals by comparing the closing price to the price range.
StochasticOscillator StochasticOscillator(Bars bars, int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType)
api.Indicators.StochasticOscillator(bars: Bars, kPeriods: int, kSlowing: int, dPeriods: int, maType: MovingAverageType) -> StochasticOscillator
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
bars | Bars | Bars | The Bars that will be used by indicator, you can pass another timeframe/symbol bars |
kPeriods | int | int | The value of the k periods used for calculation. |
kSlowing | int | int | The value of the k slowing used for calculation. |
dPeriods | int | int | The value of the d periods used for calculation. |
maType | MovingAverageType | MovingAverageType | Type of the Moving Average. |
Returns StochasticOscillator — Stochastic Oscillator indicator instance.
Examples
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyStochastic = Indicators.StochasticOscillator(dailyBars, 9, 3, 9, MovingAverageType.Simple);
Print("Daily stochastic %K: {0}, %D: {1}", dailyStochastic.PercentK.LastValue, dailyStochastic.PercentD.LastValue);
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyStochastic = api.Indicators.StochasticOscillator(dailyBars, 9, 3, 9, MovingAverageType.Simple)
api.Print(f"Daily stochastic %K: {dailyStochastic.PercentK.LastValue}, %D: {dailyStochastic.PercentD.LastValue}")
StochasticOscillator(Bars bars, int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType, StochasticCalculationType calculationType)
The Stochastic Oscillator is a momentum indicator that aims to show price reversals by comparing the closing price to the price range.
StochasticOscillator StochasticOscillator(Bars bars, int kPeriods, int kSlowing, int dPeriods, MovingAverageType maType, StochasticCalculationType calculationType)
api.Indicators.StochasticOscillator(bars: Bars, kPeriods: int, kSlowing: int, dPeriods: int, maType: MovingAverageType, calculationType: StochasticCalculationType) -> StochasticOscillator
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
bars | Bars | Bars | The Bars that will be used by indicator, you can pass another timeframe/symbol bars |
kPeriods | int | int | The value of the k periods used for calculation. |
kSlowing | int | int | The value of the k slowing used for calculation. |
dPeriods | int | int | The value of the d periods used for calculation. |
maType | MovingAverageType | MovingAverageType | Type of the Moving Average. |
calculationType | StochasticCalculationType | StochasticCalculationType | Type of calculation. |
Returns StochasticOscillator — Stochastic Oscillator indicator instance.
Examples
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyStochastic = Indicators.StochasticOscillator(dailyBars, 9, 3, 9, MovingAverageType.Simple, StochasticCalculationType.LowHigh);
Print("Daily stochastic (low/high) %K: {0}", dailyStochastic.PercentK.LastValue);
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyStochastic = api.Indicators.StochasticOscillator(dailyBars, 9, 3, 9, MovingAverageType.Simple, StochasticCalculationType.LowHigh)
api.Print(f"Daily stochastic (low/high) %K: {dailyStochastic.PercentK.LastValue}")