---
id: "P:cAlgo.API.Indicators.StochasticOscillator.PercentK"
kind: "property"
type: "T:cAlgo.API.Indicators.StochasticOscillator"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/StochasticOscillator/PercentK/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# StochasticOscillator.PercentK

Member of [StochasticOscillator](https://help.ctrader.com/ctrader-algo/references/Indicators/StochasticOscillator/index.md).

## PercentK

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.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
IndicatorDataSeries PercentK {get;}
```

Python:

```python
stochasticOscillator.PercentK: IndicatorDataSeries
```

### Returns

`IndicatorDataSeries` — 

### Examples

C#:

```csharp
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));
```

Python:

```python
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)}")
```

