# Stochastic

{% embed url="<https://www.youtube.com/watch?v=0UDszLXfatQ>" %}

​"Stochastic", developed by George Lane in **1957**, is an algorithm that determines the overbought and oversold points of a market and compares the closing price on the market with the highest and lowest price values ​​it has received within a selected period.

Stochastic consists of two lines known as K% and D% that fluctuate between 0 and 100 values. The region below 20 is considered the oversold region, and the region above 80 is considered the overbought region. The period recommended by George Lane for K% is 14 days, while for D% it is 3 days. However, some investors use 9% of K% and 5 days for D%.

* The K% line is found by subtracting the latest closing price from the lowest closing price in the period, dividing the result by the difference between the highest and lowest closing prices in the period, and multiplying by 100.                                                                                                   &#x20;
* K% = 100 x \[last close - lowest close(p)] / \[highest close(p) - lowest close(p)]
* p = number of periods determined for %K
* The D% line is calculated by averaging the K% values ​​over the specified period. In other words, K% values ​​are found by adding up and dividing by the number of periods.
* D% = (K% + K% + K% + … n) / n      &#x20;
* n: Number of periods specified for %D

<figure><img src="/files/r1HtzIEiY0MyjaJpPkxw" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
When the indicator lines fall below 20, that is, when it enters the oversold region, it is interpreted as a possible buy signal by interpreting that the current price movement will change direction.&#x20;

When the indicator lines rise above 80, that is, when it enters the overbought zone, it is interpreted as a possible sell signal by interpreting that the current price movement will change direction.&#x20;

When the indicator lines cross the 20 band upwards, it is interpreted as a buy signal, and if the indicator lines cross the 80 band downwards, it is interpreted as a sell signal.
{% endhint %}

{% hint style="success" %}
If the K% line crosses above the D% line  in the oversold region, it is a buy signal for traders. If the K% line crosses below the D% line in the overbought zone, it is a sell signal for traders.
{% endhint %}

If the bottoms and tops of the market's price action are not aligned with the bottoms and tops of the "Stochastic" indicator, a mismatch occurs. According to this; If it creates falling lows in price action and rising lows in the indicator, it is a buy signal. Conversely, if it is forming rising highs in the price action while the indicator is forming falling highs, it is a sell signal.

{% hint style="info" %}
​In order to easily obtain Stochastic detections, you can create [<mark style="color:blue;">Alerts</mark> ](https://www.youtube.com/watch?v=-yS1Cv6PYm0\&t=42s)or [<mark style="color:blue;">Custom Signals</mark>](https://www.youtube.com/watch?v=sz_pwdSpZeg\&t=27s) through the Coinlegs system, and start autotrading bots on [<mark style="color:blue;">LegsBot</mark> ](https://www.legsbot.com)by using the alerts you create.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.coinlegs.com/fundamentals/stochastic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
