OPEN-SOURCE SCRIPT

Stochastic with Divergences

Reuploading as there was an issue with the description.
This indicator uses the popular Stochastic indicator as its base. I have included the ability to draw divergences on the indicator as they occur live. By default it will be off, select the settings for the indicator and about halfway down there will be a dropdown menu that says "Off". Select it and then select which divergences you want to draw: Regular, Hidden, or Both. I like to draw both. I find that hidden divergence is really nice during a trending market and the regular divergence is works great in a range market. I also feel that the regular divergence is great during a trending market if you are given the signal but then wait for the next price movement for a double top/bottom to occur. The Stochastic indicator itself is often used in a ranging market by selling when it is overbought and buying once it indicates oversold (much like the RSI indicator). I find that it can work in trending markets if you only take overbought in a down trend and oversold in an up trend. In the above picture you can see that I had used it to trade this downtrend using both the Hidden Divergence and Sell Signals to catch the trend continuation until it failed on the fourth trade. From here I would usually start using the Stochastic as simply an oscillating indicator and buy/sell based on overbought/oversold. I've also added an option to enable the Stochastic RSI if you'd rather use that, as well as a fill option which simply colors in the space between the Stochastic and Signal lines. The Signals option will put on highlights of when to buy or sell based on overbought/oversold areas that agree with the long term trend (based on the 200 EMA).

Divergence is a short way of saying there was a higher or lower movement compared to normal but the price did not represent that movement, indicating strength or weakness in a specific direction.
Regular divergence is an indication of a trend reversal. Regular bullish divergence occurs when the price chart shows a lower low while the stochastic shows a higher low. Regular bearish divergence occurs when the price chart shows a higher high while the stochastic shows a lower high.
Hidden divergence is an indication of a trend continuation. Hidden bullish divergence occurs when the price chart shows a higher low while the stochastic shows a lower low. Hidden bearish divergence occurs when the price chart shows a lower high while the stochastic shows a higher high.

The "Only Trending Divergences" option, if enabled, will only show bearish divergences during a down trend (price is below 200 EMA) and only show bullish divergences during an uptrend (price is above 200 EMA). I like to use this option and have set it to ON by default.
The "Middle Filter" option, if enabled, ensures that Highs on the stochastic indicator will not be counted as Highs unless they are above the middle value of the oscillator (which is 50), same goes for lows: they will not be counted as Lows unless they are below the middle value of the oscillator.


I also include buy/sell signals that coincide with the trend (based on the 200 EMA). If price is currently below the 200 EMA and the stochastic indicator is overbought (over 80), you can get a sell signal when it the blue line crosses down below 80. This sell signal shows that you are in a down trend and the price just was overbought but is now likely to continue pushing downwards. The opposite works for buy signals: Above 200 EMA, stochastic goes below 20, when it crosses above 20 it will show a green highlight to indicate price is likely to push upwards.

I think the default options are likely the best to use. The only one I tend to change on occasion is the "Pivots to look back" which I adjust usually to either 1 or 3.

Stochastic Oscillatorstochasticdivergencestochasticoscillatorstochastic-rsiStochastic RSI (STOCH RSI)

Script open-source

In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?

Declinazione di responsabilità