MACD & Stochastic Alignment Oscillator v2

How does it works?

It's combination of two oscillators - Moving Average Convergence / Divergence (MACD) and Stochastic Oscillator. When signal (trend) is aligned and pointed in the same direction by both, MACD and Stoch, it's much more powerful combination than standard use separately both of oscillators.

Input settings

  • Resolution - by default calculations are based on timeframe selected for the chart, but there's possibility to calculate oscillators based on different timeframe
  • Fast Length, Slow Length, Signal Smoothing - standard inputs for MACD, default ones works quite well on various timeframes
  • K, D, Smooth - standard inputs for Stochastic calculations, settings 21,7,7 seems to work quite efficient in our opinion and much better than some faster settings (like 8,5,5 or 13,8,5 widely used)
  • Oversold, Overbought - values of extreme zones of Stochastic
  • MA Type for Stochastic - type of Moving Average used for calculations in Stochastic oscillator
  • Pivots Lookback Right - number of candles used for confirmation marking high/low on indicator, (please note that higher the number, then later signal will appear - we recommend to keep it at 1)
  • Pivot Lookback Left - sensitivity setting for finding new high/lows in indicator, lower the number then more sensitive lookback for finding pivots highs/lows
  • Max/Min of Lookback Range - marks the minimum and maximum period when looking for divergences
  • Plot checkboxes - choose which types of divergences to search for and plot on indicator

Signals

Indicator generates signals as:
  • Trend alignment
Signals appears when both oscillators - Stochastic and MACD - are aligned in direction of the position. They can be used either to entry/open new position as well as exit/secure already opened position (works simply as potential reversal warning sign).
The biggest chance of success have alignments that appear after recent visit of extreme zone by Stochastic oscillator (so overbought/oversold zone).
Signal (so coloured background) appears only when alignment is in direction of last exit from extreme (overbought/oversold) zone by Stochastic - so if recently oscillator exit oversold zone and didn't reach overbought zone - still only alignment in "Long" direction will be searched.
  • Divergences
Divergences very often warn before sudden reversal will take place on the market we're analysing. Longer and more steep divergence marked on oscillator, then higher chance of its' success. They appear when price is travelling in opposite direction to oscillator (e.g. price is making new higher high, but oscillator is making lower low).
Alerts and plot of divergences differ from settings of plotting them - in Input Settings of indicator you decide which types of divergences to search for.

Alerts

Two custom alerts were added next to standard options offered by TradingView:
  • Divergence found - this type of alerts fired after finding divergence (marked as active in Input settings)
  • MACD/Stoch Alignment signal - alert fired after pointing up the same direction of trend by both - MACD and Stochastic
We strongly suggest using "Options" in alerts configuration set to "Once per bar close" what will limit false signals and secure from repainting.