Forex stochastic oscillator
How does forex stochastic oscillator work: formula, advantages and disadvantages, application to trade. Modifications of original stochastic and practical examples of trading strategies based on them.
Stochastic oscillator is one of the common tools used in different forex trading strategies, both in short term and position trading. It is well combined with trend oscillators on different timeframe and serves as additional filter in technical analysis. Its formula has been many times upgraded, but it has been quite popular among traders of different experience for over fifty years. Read on in the article about how stochastic works, about it s basic calculation formula, how you can read stochastic signals. I will also describe practical examples of trading strategies on they basis of forex stochastic oscillator.
Stochastic oscillator: theory and practice for newbies and advanced traders
I believe each trader has come across a basic technical tool, stochastic oscillator. It is included into all major trading platforms; it often recommended to be studied first in most of textbooks for beginner traders. However, it is also often criticized for sending not exact signal. But, it should be noted that stochastic is not designed to be the main indicator to build a trading strategy on. It is used as supplementary tool to the main indicator to reduce the number of false signals. So, it does not make any sense to criticize it. I have already described partially this indicator in this overview, so I will briefly deal with the indicator formula, signals interpretation and then move on to practical examples of the stochastic application to trade forex.
Theory of stochastic oscillator: principle, formula, signals.
Initially, stochastics had nothing to do with trading. The indicator developer, George Lane was originally aiming at defining the mathematical ratio of the amount of limestone added during smelting to iron ore to produce steel. Later, the formula most accurately describing the regularity was applied already in relation to trading in the forex market.
A stochastic oscillator is a momentum indicator. It compares a current price (the price type is specified in the properties, but, the closing price is usually analyzed) to a range of its prices between the highest and the lowest price over a certain period of time.
- Example. You enter the period of 20 day in the parameters. This means that the indicator finds out the price high and low over this period and compares them to the current price. Simply put, if 15 days ago, the price high was at 1.1150, the current price is 1.1100, the difference will be 0.0050. The less is the difference, the closer is the stochastic to a level of 0 or 100. This is a rough description as the stochastic formula is much more complex.
The indicator display the percentage of the current price and the price extremes. If the value is 50%, the current price is in-between. When the current price is getting nearer to the extremes, it means that the price will reverse at the level of or next to the extreme. With each new bar, the indicator values are recalculated, since the time interval changes.
The most commonly used stochastic formula:
- %К (major line of the indicator, a solid line) = 100*( (С – Min)/(Max-Min) ). C is the most recent closing price. Max and Min are the price high and low over the period indicated in the settings.
- %D (the signal line of the indicator, a dotted line) = МА (М) of %К. So, %D is the moving average with the period M of %К. It sometimes is referred to as a fast stochastic.
This formula is a basic one on trading platforms.
Parameters of the indicator:
- %К is the period of the oscillator.
- %D is the period of the signal line that is the moving average of the main line.
- Slowing is additional smoothing of both lines (reduced influence of the market noise that is random price swings).
- Price field is the price analyzed (open/close or high/low of the bar)
- MA method is the method of the %D calculation
Indicator has two lines that are moving between levels 0 and 100. The most common interpretation of stochastic signals.
- Indicator entered the overbought zone of 80-100 or the zone of oversold conditions 0-20. The trend may reverse. If both lines, being in the key zones, are heading outside the zone, the signal is stronger.
- The crossover of the slow and the signal lines inside the zone.
- Divergence (it can be either bullish or bearish divergence, according to the type of trade).
As many other indicators, the stochastic has a flaw of dependence of lagging and the number of false signals on the period (time interval). If it is short, the indicator responds to each next bar very sharply. If the period is too long, the signals are lagging. For example, if 13 out of 14 periods (bars) had roughly equal closing price (trading flat), and the tenth bar’s close is much greater, indicating the trend start, because of the 13 nine other bars, the stochastic value won’t change much. It can be managed by selecting the period for each asset and correcting it regularly.
I would like to add a few words about modifications of the stochastic oscillator. The most popular versions are described in this article. Next versions may serve as separate indicator. In this tools, the basic stochastic formula is smoothed in some way, attached to other indicators and so on. You will see how these tools work in practice in the strategies described below.
Five profitable forex strategies based on the stochastic and its modifications
The strategies described below are the examples of how a forex trader can discover entry signals using the stochastic both as the main and as a supplementary tool. I offer these strategies to study not as a perfect trading tool with a minimal risk of losses, rather, I want to demonstrate how one can estimate the accuracy of signals, how one should in general apply the oscillator and compare its performance with the modifications. In other wards, I’d like to encourage you to think, notice, analyze.
Each description contains the link to the free template of the indicator and the strategy for MT4. You can read about how to add them to the platform in the second half of this article.
1. Trading in the morning with Slow Stochastic
The European session is the best time, in terms of activity, to trade the EUR/USD pair. One can make a greater profit from the volatility than during other sessions. At the beginning of the session, the pair is trading by inertia in the first few hours, when it is suggested to trade according to this strategy.
Slow Stochastic, whose template can be downloaded here, differed from the original oscillator in that it uses in calculation the total of the price values of the last three bars divided by three. That is, at the last section, there is averaging of the indicator, smoothing, due to which the indicator’s line moves slower and smoother. Smooth movements are partially an advantage, as the signals are more logical and predictable. However, they may be also lagging, especially in day trading.
Timeframe is M5, currency pair traded is EUR/USD, parameters of Slow Stochastic: PK = 14, PD = 5, PS = 5, Levels – 10 and 90. Note that the levels are located higher deliberately. The strategy doesn’t suggest a pursuit for the number of trades. You may set the standard levels of 20 and 80, but this will increase the error risk.
Conditions for entering a long trade:
- Trading time is from 9.40 to 10.20 Eastern European Time. You don’t trade during the first 40 minutes as the price movements can’t be anticipated during this time period.
- Slow Stochastic must go down to the oversold zone during this time (below level 10).
- Before 9.40, the Slow Stochastic didn’t go lower than level 10 at the past eight bars.
Once the stochastic crosses the target level, you enter a trade at the next bar. It doesn’t matter where the stochastic lines are directed (towards zero level or outside the zone) the signal is when the line crosses level 10.
Target profit is 10 pips, stop loss is also 10 pips. When the target profit is reached, the trade is exited. You may risk and leave 50% of the position open, moving the stop to the breakeven.
It is clear from the screen that the indicator is entering the oversold zone (below level 10), next, you wait until one more bar closes and enter a trade after that. Even if the trade was entered one bar earlier, the stop would not be triggered. The arrow marks the entry point. Horizontal red lines mark from top to bottom: take profit, entry and stop loss.
Conditions for entering short trade:
- Trading time is from 9.40 to 10.20 Eastern European Time.
- Slow Stochastic must go up into the overbought zone (above level 90) during this time.
- Before 9.40, the Slow Stochastic didn’t go higher than level 80 at the past eight bars.
The entry conditions are similar to that of the long trade.
Note that, unlike the previous previous situation, when the indicator has been in the oversold zone for some time after the trade was entered, in this case it goes outside almost immediately, but this doesn’t affect the result. As I have noted above, it is not so important how fast the indicator exits the zone, the sell signal are strong when it crosses the key level when the trade is entered.
Strategy allows at least avoid the loss. Indicator quite well picks up the inertia movement and in the worst case, the position is closed at breakeven. It is not recommended to extend the levels to 20 and 80, but you may extend the time period. However, there is a risk that the stop loss will work out more often.
2. Combination of CCI Stochastic and Heiken Ashi
This strategy uses an unusual combination of two indicators, each of which is itself unusual and is rather rarely used in classical trading.
1. CCI Stochastic. This is an arrow indicator that is based on a common stochastic oscillator and the commodity channel index. General rules of its application are explained here. I will only add some information about how it is build.
The indicator was developed by Donald Lambert, who first published the information about the CCI in 1980. It is based on the following theory: if the price deviates from the moving average (averaged price value over a few bars) more than the standard deviation of the specified period, it suggests that the trend may reverse. The CCI calculation formula is based on the Typical Price (the total of the high, the low and the closing price divided by three), probable mean deviation and the moving average of the typical price. You can easily find the formula on the Internet.
It is suggested that the CCI has levels of 100 and 100, but they are of a more visual nature. It means that you can’t interpret the crossing of these levels as an accurate signal. Another matter is the stochastic, where levels 20 and 80 clearly display the overbought and oversold areas. CCI Stochastic is an attachment of the stochastic levels (that is the oscillator itself) to the CCI formula. The stochastic applied to the CCI defines the range of levels.
2. Hama Jurik. It is a modification of the Heiken Ashi indicator. Heiken Ashi is one of the versions of the candlestick chart that is radically different from Japanese candlesticks. A Japanese candlestick specifies 4 types of price: open, close, high and low of a bar. Everything is clear.
In the Heiken Ashi chart, a bar also has similar types of the price, but it uses a different calculation algorithm, averaging. Each new bar is built from the middle of the previous one. The calculation algorithm is as follows:
- Opening price is the average of the previous open and close.
- Closing price is the average of the previous open, close, Max and Min.
- Max is the average of the previous open, close and Max.
- Min is the average of the previous open, close and Min.
It is thought that Heiken Ashi candlesticks, though they are a little lagging, paint a smooth chart without repainting that clearly displays the trend direction.
Due to a different calculation formula, the Heiken Ashi candlesticks are attached only to a linear price chart, that is, they are not compatible with the Japanese candlesticks.Hama Jurik is an alternative indicator that allows working with the common candlesticks and with the Heiken Ashi at the same time. In the chart, it looks like candlesticks of different color that are above/below the common Japanese candlesticks. Red candlesticks indicate a downtrend, green ones – an uptrend.
CCI Stochastic parameters:
Hama Jurik parameters: МА period = 10, МА method =2, Shift = 1, BetterFormula = false, Jurik = true, Length = 20, Phase = 0.0.
Conditions for entering long trade:
- CCI Stochastic paints a green arrow.
- Current or next candlestick closes higher than the body of the Heiken Ashi candlestick. It will be perfect if the Heiken Ashi candlestick is completely engulfed by the previous Japanese candlestick.
After the both conditions have been met, you enter a trade with a stop of about 20 pips. Target profit is 20 pips. Next, you act according to the situation: you either close the entire position or close a half of it and protect the rest half with a trailing stop.
The screen presents the following situation: the CCI Stochastic paints a green arrow that appears as soon as it goes outside level 10 (marked with a yellow circle). The signal candlestick has a big body that fully covers the Heiken Ashi. Although the Heiken Ashi is red, the body of the candlestick is small which means that the downtrend is exhausting. It is within the Japanese candlestick which is the second signal. Pay attention to other Heiken Ashi candlesticks, they are higher or lower than their preceding Japanese candlesticks (examples to compare).
The next situation is also remarkable, it marked with a green circle. Here, the CC Stochastic also paints a red arrow and goes outside the overbought zone. But at the next candlestick, where one could have entered a trade, there is not met the condition for Hama Jurik indicator with the Heiken Ashi candlestick. As you see from the screenshot, a short trade in this case could have been profitable, but I don’t recommend risking.
Conditions for entering a short position:
- The CCI Stochastic paints a red arrow.
- Curren or next candlestick closes lower than the body of the Heiken Ashi candlestick.
Entry conditions are similar to that of a long trade.
Indicator paints a red arrow at the next candlestick after it has entered the oversold zone. The candlestick, where the arrow appeared, closes at the level of the Heiken Ashi candlestick (the Heiken Ashi color doesn’t matter), this level is marked by a black horizontal line. This means that the second condition hasn’t been met and one shouldn’t enter a trade. This condition is satisfied at the next candlestick, so, it can be called signal. At the next candlestick (highlighted with a pink box), the trade is entered.
A few comments on exit rules. There can be several ways:
- The trade is exited by a take profit. In both cases, the price not only reaches the take profit, it is going farther. It is a conservative option with a minimal risk.
- You exit the trade when the CCI Stochastic reached the opposite key level (90 – for a long trade, 10 -for a short), this way worked out only in the second example.
- You close the position when the Heiken Ashi changes its color. In the both examples described, this way won’t yield a profit, but it works out sometimes.
The first option could be called perfect, but you may combine exit principles. As I’ve already mentioned above, you can close 50% of the positions at a target profit level (you can close 60% or 80%, it is up to you) and protect the rest of the position by a trailing stop, thus getting the most of the market.
When there are published the news marked as important in the economic calendar, you do not enter a trade one hour before and one hour after the publication. A stronger signal is when Heiken Ashi candlestick changes the color at the next candlesticks (green is for a long position, red – for a short one).
3. Forex strategy with a combined indicator on the basis of stochastic
Unlike the previous strategy, where the modified stochastic is the major indicator, here, a classical oscillator is used. The only difference is that this indicator is a complex tool, and, in addition to the stochastic, its formula includes the values of the standard MACD, RSI and Momentum.
The first two are quite common, but the situation with the Momentum indicator is a bit more complex. It is referred to both oscillators and trend indicators. It has several calculation formulas, which makes up its complexity. One of them suggests using the difference between closing prices of the current and the previous (a few bars ago) periods. Another version suggests the ratio of these values. The farther the Momentum moves from zero level, the stronger is the market overbought or oversold.
Each of the basic indicators doesn’t deliver explicit signals. This strategy is remarkable because the combination of 4 oscillators yields quite a decent average result. This complex indicator is called MBA, you can download its template here. The needed parameters are already included in the code. The recommended timeframe is H1, pairs traded are EUR/USD, USD/CHF, GBP/USD.
Conditions for entering a long position:
- You look for signals only during the European trade session.
- MBA paints a series of columns above zero level.
- After the previous condition is met, there is a column with zero value.
- Following zero column, the indicator paints a column with the values of 1-2 and more. The higher is the column, the stronger is the signal. There should be a rising candlestick at this column. You can see the indicator value in the MT4 information panel.
You enter a trade at the next candlestick. There is not a clear recommendation on a stop loss level. You can put it a little lower than the local low, but it is better to check this point on the historical data. A target profit for this currency pair is 20 pips, the recommendation is not strict. You can also hold the trade longer until there is a red column (a column of the opposite color).
It is clear from the figure that the MBA paints a series of rising green columns, next, it shows a decline and, finally, there is a candlestick in the chart where there is not a column. It is good if there is also a reversal pattern. In this case, at a zero (missing) column, there is candlestick with a long lower shadow ( a Hammer pattern). You enter a trade at the first or the second green column. You exit the trade when the take profit is reached or when there is a red column. In this example, the second exit option would have provided a double profit.
Pay attention to another two situations marked with green arrows. In the first case, the indicator also paints rising columns, followed by a falling red one, and next, a few short green columns (that where the arrow points to). But the columns are less than 1 (this is indicated in the indicator window on MT4), so, one should not enter a trade. In the second case, there is not a zero column, but the following green are greater than 2 and an entered trade could have yielded a profit. It is important that the column should be close to zero at the signal candlestick, and they following green columns should be greater than 2, the higher they are, the stronger is the signal.
The strategy suggest that you enter long and short trades on more than a single currency pair. So, as alternative, you may consider negatively correlated pairs, and, when you open a long trade one currency pair, based on the MBA signal, you enter a short on the second one. Foe example: EUR/USD, USD/CHF.
4. A simulator based on the stochastic for beginner traders
There is an opinion that the simpler is a forex strategy, the less likely it to be working. Many believe that it is impossible to trade according to a single signal. There must be a combination of a few factors – patterns, signals of several indicators and so on. I could partially agree with this opinion. But there is another extreme: some traders look for matches where none exist, and, as a result, give desirable for valid.
The strategy described below has just a single entry conditions, the signal delivered by the indicator. Is it enough? I suggest you download the template archive and test it on the historical data, and share your results in the comments.
The strategy uses an author’s indicator that is a combination of the ATR and the stochastic. The algorithm of identification of good entry points is based on the data of these indicators. The strategy principle is based on the position reversal: first, you enter a trade according to the signal, you reverse the trade when there is an opposite signal. Timeframe is H4, currency pair is EUR/USD. Indicator settings:
The first two parameters do not affect the calculation. The first means that you enable the record of the alert into a file; the second one means that each signal is assigned its unique number. Length is the period (the major parameter of the indicator), Price means the price type, according to which the data are analyzed (0 – calculation based on the closing price prices). Other parameters are developed by the author, so I suggest leaving the default values. If you wish, you can study the code and share your opinion about these parameters in the comments.
Conditions for entering a long trade:
- Indicator paints a green dot.
It is the only and sufficient condition. You enter a trade at the next candlestick. The strategy combines middle- and long-term trading, so, you may set target profits and stop losses quite far if you trade in a longer term. The target profit is 50-60 pips, stop loss is 50-60 pips. You can also exit the trade when the indicator paints a red dot.
Yellow circle marks the section of the price chart that is not good to enter a trade as constant change of the trend direction according to the signals will finally lead to a loss due to spread or a stop loss. For example, if you enter a trade at the next bar after the firs red dot, you will have to reverse it almost immediately. But the trade, entered according to the fourth signal of the indicator (the entry point is red, the exit is green), would yield over 250 pips of profit, covering the previous loss.
Conditions for entering a short trade:
- Indicator paints a red dot.
The entry conditions are similar.
You skip the first candlestick on Monday and the last candlestick on Friday, exclude the time period of 1 or 2 candlesticks around the rime of important news release. You should also ignore the signal if the signal candlestick has a relatively big body compared to the others. An example of such a situation is displayed in the first screenshot at the second (green) and the third (red) signals.
The strategy is good as psychological simulator. It yields quite many losing trades due to a reversal amid an opposite signal. But, if there is a winning trade, the profit will entirely cover the previous loss. The trader’s task is to pick up a strong trend and take a profit of 50-60 pips or more from it.
5. Trading based on the Stochastic and the Moving Average Envelopes signal line.
It is a basically channel trading strategy, where the stochastic is a supplementary tool that is applied in an unusual way. In the settings, the color of the major line is white, that is, it is not visible in the chart, and the trading is based only on its signal line (%D). The major indicator is MA Envelopes that is described in detail here. I will only describe its calculation principle.
Envelopes consists of two Moving Averages that are on the both sides of the price. They form a kind of a channel that looks like another popular channel indicator Bollinger Bands. The difference is in the calculation formula:
- Upper MA (Upper) = SMA (Close, N) * (1 + K/1000).
- Lowe MA = SMA (Close, N) * (1 – K/1000).
SMA is a simple moving average that is calculated based on the closing prices, N is the averaging period, К/1000 is a deviation in tenths of a percent of the average. The deviation is adjusted to the pair volatility, there higher is the volatility the greater is the deviation. The shift is the indicator shift into the past relative to the current bar (to the left, negative value) or its projection into the future (to the right, positive value).
The strategy suggests you pick up the moment when the price breaks through the Envelopes channel. The stochastic signal line serves as a filter: at the breakout moment, it must be in the overbought or oversold zone.
Timeframe is H4, currency pair is GBP/USD, by adjusting the Envelopes parameters, you can find out the values for any currency pair. You should custom them in the following way: in the history, you find the moments when the stochastic enters the key zones and change the parameters so that the price should break out the channel at these moments. Basic parameters of the indicator for the GBP/USD pair:
- Envelopes: Period = 12, Shift = 0, MA Method EMA, Apply K = Close, Deviation = 0.8.
- Stochastic: %К = 5, %D = 3, Slowing =3, Price: Low/High, MA Method – SMA, Levels are -20 and 80.
You can download the template archive via this link.
Conditions for entering a long position:
- The price touches the lower line of the Envelopes. The stochastic signal line is in the oversold zone (below level – 20).
When the channel border is broken out, you enter a trade. As the price may go down by inertia, a stop loss could be set at quite a long distance – 40-60 pips. You exit the trade either when a target profit of 30-50 pips is reached or the price reached the middle line of the channel.
In this interval, the entry condition has been met only once, but the trade is winning. The take profit level was very close to the channel middle line (yellow circle).
Conditions for entering a short trade:
- The price touches the upper border of the Envelopes. The stochastic signal line is in the overbought zone (above level 80).
Entry and exit conditions are similar to the long trade.
Now, look at the following situation:
You don’t enter a trade either in the first case or in the second one. In the first case (yellow circles), the stochastic is above level 20 when the price touches the lower line. This means that the downtrend has not yet exhausted and there is still a probability that, even if the stochastic enters the oversold zone at the next bars, it could stay there. So, one should not enter a trade at the next bars, including the second situation (green circles). Even though the trend has turned out to be rising after the second touch, such a movement do not always occur.
A few more tips:
- An important conditions of the signal validity is that the stochastic must be directed up at the signal bar, and it should go outside the extreme zones as fast as possible.
- You should not enter the next bars if the stop loss has worked out.
This is an example of unsuccessful entry. All conditions are met at the first bar, but the stochastic remains in the oversold zone and the trade would be closed by a stop loss at the next falling bar. The indicators don’t provide 100% of valid signals, but the loss would be grater without a stop loss, Green circle marks the signal that also meets all conditions, but, as the previous trade could have been exited by a stop loss, the trade here is not entered too.
And the last example where all the previous conditions are met:
Red arrows indicate the points where all the short entry conditions are satisfied, the trade is winning. Another situation is with the trade marked with green arrows. Here, although all the conditions are met, the trade is losing. As the stochastic remains in the overbought zone, and the stop loss works out, one should not enter the trade at the bar marked with blue arrows.
Conclusion: Although the stochastic oscillator is often criticized, it has been used over a few decades already. Its formula has been interesting for traders during more than fifty years, and constantly appearing new modifications are vivid evidence. The example of the last forex trading strategy described in the article proves that the stochastic is just a supplementary filter reducing the number of false signals. But it is not perfect either. How can you improve your trading performance using a stochastic? I think you should experiment, test, develop you trading intuition. Do you agree? Please, do write your ideas of how you can apply the stochastic to trade in the comments after the article.
I wish you successful trading!
P.S. Did you like my article? Share it in social networks: it will be the best “thank you” 🙂
Ask me questions and comment below. I’ll be glad to answer your questions and give necessary explanations.
- I recommend trying to trade with a reliable broker here. The system allows you to trade by yourself or copy successful traders from all across the globe.
- Use my promo-code BLOG for getting deposit bonus 50% on LiteForex platform. on LiteForex platform. Just enter this code in the appropriate field while depositing depositing your trading account.
- Telegram channel with high-quality analytics, Forex reviews, training articles, and other useful things for traders https://t.me/liteforex
Price chart of EURUSD in real time mode
The content of this article reflects the author’s opinion and does not necessarily reflect the official position of LiteForex. The material published on this page is provided for informational purposes only and should not be considered as the provision of investment advice for the purposes of Directive 2004/39/EC.