Skip to content

StochasticOscillator.PercentK

property · StochasticOscillator · cAlgo.API.Indicators

DesktopCLICloud

Calculation of %K is 100 multiplied by the ratio of the closing price minus the lowest price over the last N periods over the highest price over the last N minus the lowest price over the last N periods.

Definition

IndicatorDataSeries PercentK {get;}
stochasticOscillator.PercentK: IndicatorDataSeries

Returns IndicatorDataSeries

Examples

var stochastic = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
if (stochastic.PercentK.Last(1) > stochastic.PercentD.Last(1) && stochastic.PercentK.Last(1) < 20)
    Print("%K is above %D in the oversold zone: {0}", stochastic.PercentK.Last(1));
stochastic = api.Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple)
if stochastic.PercentK.Last(1) > stochastic.PercentD.Last(1) and stochastic.PercentK.Last(1) < 20:
    api.Print(f"%K is above %D in the oversold zone: {stochastic.PercentK.Last(1)}")