Stochastic strategy with a trend filter, explained

By Oalgo · Last reviewed

A Stochastic oscillator strategy uses %K and %D to see where the close sits in the recent high-low range. A common rule is to enter when %K crosses above %D while both are below 20, and to exit when %K rises above 80. A trend filter, such as the close above a 50-period EMA, keeps the rule out of a down-trend.

Chart: example prices with the Stochastic oscillator below them: %K, %D and dashed lines at 80 and 20. A rule acts where %K crosses %D near a level.PriceHigh to low%K%D8020
Example prices, made up for this page. Settings 14 and 3.

What are the rules of a Stochastic strategy?

#
  • Trend filter: the close is above the 50-period EMA.
  • Entry: %K (14 candles) crosses above %D (a 3-period average of %K) while %K is below 20.
  • Exit: %K rises above 80.
  • Stop: a Stop Loss as a percentage, because %K can stay low while price keeps falling.

How do you write this strategy in Oalgo?

#

In Oalgo you can tell Oalgo AI your Stochastic rule in your own words, check the rule it builds, and test it. After testing, if you choose, you Go Live with your own Live Strategy on your own Venue Account at a Supported Venue.

For example, you could tell Oalgo AI: "Enter when the close is above the 50-period EMA and Stochastic %K crosses above %D while %K is below 20. Exit when %K rises above 80. Use a 1.5% Stop Loss and a 3% exit target." These numbers are examples to change. A Live Strategy needs a stop on each side it can enter, and an exit target is optional. The example names both.

How do you test this strategy honestly?

#
  • Run a backtest on more than one date range, including a falling one, to see what the filter does.
  • Check the fees and the number of trades. %K moves fast and crosses %D often.
  • Move the levels, for example 20 to 15 and 25, and the periods a little. If the report changes a lot, the first result may be fitted to the past.
  • Run a forward test on new prices, with simulated funds.

What can a Stochastic strategy not tell you?

#

In a strong move %K can stay near one end of its scale for many candles, so a low reading is not a turn. The 80 and 20 levels are a habit, not a rule of the maths. The filter follows price and comes late when a trend ends. The RSI strategy page covers a similar idea with a different oscillator.

Read next