Stochastic 20/80
The Stochastic compares the close price with the recent range and draws two lines: the fast %K and the slow %D. The robot opens a trade when the lines cross in an extreme zone: below 20 for a buy and above 80 for a sell.
Choose a platform: MT5 shows the chart and Inputs screenshots from MetaTrader 5, MT4 shows the chart with entries and the Inputs screenshot from MetaTrader 4.
How the robot trades
When it buys
The %K line crosses %D upward while %K is below the low level.
When it sells
The %K line crosses %D downward while %K is above the high level.
When it exits
A buy closes when %K drops below %D; a sell closes when %K rises above %D.
Screenshot 1 of 5
The conditions as constructor blocks
Open a buy
Open a sell
Close a buy
Close a sell
Inputs
These inputs appear in the expert advisor settings in MetaTrader 5 or MetaTrader 4, and they are what the strategy tester goes through when it optimises the robot.
| Input | Default | What it means |
|---|---|---|
| InpStoch_K_kPeriod | 5 | %K period: how many recent candles the position of price in the range is taken from. |
| InpStoch_K_dPeriod | 3 | %D period: the smoothing of the %K line. |
| InpStoch_K_slowing | 3 | Slowing: extra smoothing of %K to make the line calmer. |
| Stoch_Low | 20 | Low level: a buy is allowed only while %K is below it. |
| Stoch_High | 80 | High level: a sell is allowed only while %K is above it. |


How to tune the robot to your style
- Move the levels, for example to 30 and 70, and watch how the number of signals changes.
- Change the line periods: short ones react faster, long ones give fewer false signals.
- Add a trend filter so the robot does not trade against a strong move.
You can do all of this in the constructor without signing up. To save your changes and come back to them later, you need an account.
Risks
How a strategy behaved in the past does not predict its future results. Check the robot in the strategy tester and on a demo account first, and only then decide whether to trade it with real money. This robot is an example to adapt to your instrument, timeframe and risk rules.