OPEN-SOURCE SCRIPT

MACD Plus

Updated
Moving Average Convergence Divergence – MACD

The MACD is an extremely popular indicator used in technical analysis. It can be used to identify aspects of a security's overall trend. Most notably these aspects are momentum, as well as trend direction and duration. What makes the MACD so informative is that it is actually the combination of two different types of indicators. First, the MACD employs two Moving Averages of varying lengths (which are lagging indicators) to identify trend direction and duration. Then, it takes the difference in values between those two Moving Averages (MACD Line) and an EMA of those Moving Averages (Signal Line) and plots that difference between the two lines as a histogram which oscillates above and below a center Zero Line. The histogram is used as a good indication of a security's momentum.

Added Color Plots to Settings Pane.
Switched MTF Logic to turn ON/OFF automatically w/ TradingView's Built in Feature.
Added Ability to Turn ON/OFF Show MacD & Signal Line.
Added Ability to Turn ON/OFF Show Histogram.
Added Ability to Change MACD Line Colors Based on Trend.
Added Ability to Highlight Price Bars Based on Trend.
Added Alerts to Settings Pane.
Customized Alerts to Show Symbol, TimeFrame, Closing Price, MACD Crosses Up & MACD Crosses Down Signals in Alert.
Alerts are Pre-Set to only Alert on Bar Close.
Added ability to show Dots when MACD Crosses.
Added Ability to Change Plot Widths in Settings Pane.
Added in Alert Feature where Cross Up if above 0 or cross down if below 0 (OFF By Default).


Squeeze Pro
Traditionally, John Carter's version uses 20 period SMAs as the basis lines on both the BB and the KC.
In this version, I've given the freedom to change this and try out different types of moving averages.

The original squeeze indicator had only one Squeeze setting, though this new one has three.
The gray dot Squeeze, call it a "low squeeze" or an "early squeeze" - this is the easiest Squeeze to form based on its settings.
The orange dot Squeeze is the original from the first Squeeze indicator.
And finally, the yellow dot squeeze, call it a "high squeeze" or "power squeeze" - is the most difficult to form and suggests price is under extreme levels of compression.

Colored Directional Movement Index (CDMI), a custom interpretation of J. Welles Wilder’s Directional Movement Index (DMI), where :
DMI is a collection of three separate indicators ( ADX , +DI , -DI ) combined into one and measures the trend’s strength as well as its direction
CDMI is a custom interpretation of DMI which presents ( ADX , +DI , -DI ) with a color scale - representing the trend’s strength, color density - representing momentum/slope of the trend’s strength, and triangle up/down shapes - representing the trend’s direction. CDMI provides all the information in a single line with colored triangle shapes plotted on the bottom. DMI can provide quality information and even trading signals but it is not an easy indicator to master, whereus CDMI simplifies its usage. The CDMI adds additional insight of verifying/confirming the trend as well as its strength

Label :
Displaying the trend strength and direction
Displaying adx and di+/di- values
Displaying adx's momentum (growing or falling)
Where tooltip label describes "howto read colored dmi line"
Ability to display historical values of DMI readings displayed in the label.

Added "Expert Trend Locator - XTL"
The XTL was developed by Tom Joseph (in his book Applying Technical Analysis ) to identify major trends, similar to Elliott Wave 3 type swings.
Blue bars are bullish and indicate a potential upwards impulse.
Red bars are bearish and indicate a potential downwards impulse.
White bars indicate no trend is detected at the moment.

Added "Williams Vix Fix" signal. The Vix is one of the most reliable indicators in history for finding market bottoms. The Williams Vix Fix is simply a code from Larry Williams creating almost identical results for creating the same ability the Vix has to all assets.

The VIX has always been much better at signaling bottoms than tops. Simple reason is when market falls retail traders panic and increase volatility , and professionals come in and capitalize on the situation. At market tops there is no one panicking... just liquidity drying up.

The FE green triangles are "Filtered Entries"
The AE green triangles are "Aggressive Filtered Entries"
Release Notes
Improvement in DMI code

Added as source:
  • On Balance Volume (OBV)
    Accumulation Distribution (AccDist)
    Price Volume Trend (PVT)


Release Notes
Migrated to v5.

Added Background and Bar Colors to MACD.

Added Alerts to Williams Vix Fix (Aggressive Entry and Filtered Entry). Alerts are Pre-Set to only Alert on Bar Close.

Added Alerts to DMI (Bearish or Bullish Trend). Alerts are Pre-Set to only Alert on Bar Close.
Release Notes
Added "HLCC4" source.

Now it shows the different divergences.

Added alternate moving average types:
- Median
- Coefficient of Variation Weighted Moving Average.
- Fractal Adaptive Moving Average.
- ADX Weighted Moving Average.
- EMA RSI Adaptive.
Release Notes
Added Alerts to XTL (Bearish or Bullish Trend). Alerts are Pre-Set to only Alert on Bar Close.
Release Notes
User can select to use either Histogram or MACD Line for Divergence detection (Histogram by default).
Release Notes
Improved the DMI label.

The MACD histogram was enlarged for a better visualization.

Small change in the color of the bars and the background, and also in the divergences.

Added two types of moving averages:
- VAMA (Volume Adjusted Moving Average of allanster)
- New WMA

If you choose MEDIAN for the type of moving averages, you should follow the advice of the user maksumit:

The recommended settings for the Daily Time Frame: 5 day period for the fast line, a 20 day period for the slow line, and a 10 day period for the signal line. (5 days represent a trading week, 10 days is two weeks, and 20 days is 4 weeks or a month)

For the weekly charts, use 4 week period for the fast line, 13 week period for the slow line, and 8 week period for the signal line. (4 weeks represent a month, 8 weeks is two months, and 13 weeks is 3 months or quarterly)

And for monthly charts, use 3 month period for the fast line, 12 month period for the slow line, and 6 month period for the signal line. (3 months is quarterly, 6 months is bi-yearly, and 12 month is yearly)

It'll be challenging to measure for intraday since there are many different timeframes within intraday. The settings mentioned above should also be customized as per the requirements of the trading strategy.
Release Notes
Added the IV Rank/Percentile indicator. This indicator is meant to be a substitute for Implied Volatility Rank and Percentile for traders who do not have access to readily available options data. This indicator is based on the William's VixFix which is an indicator that mirrors the VIX, which charts the implied volatility of the S&P500. The great thing about the VixFix is that it can be applied to any security, not just the S&P500.

IV Rank and IV Percentile are often wrongly used interchangeably, but they are very different. Most people use IV Rank as their main options tool; while IV percentile is a great way to give IV Rank context. Whichever you choose to use, or even both, does not really matter as long as you use either one or both consistently.

IV Rank and IV Percentile are mainly used in this way: when IVR/IVP < 50, buy options, when IVR/IVP > 50 sell options. The reason that you buy options when IVR/IVP is low is because IV is mean reverting, so you would expect IV to eventually start increasing towards the mean, causing prices to move. The reason you would sell options when IVR/IVP is high is because IV is mean reverting and you would expect IV to decrease towards the mean, causing prices to move sideways.

In this script there are two lines, one denoting IVR and one denoting IVP. IVR is the line which is green when it's above 50 and pink when below 50. IVP is the line which is aqua when above 50 and orange when below 50.

Added MACD-V Volatility Normalized Momentum. This indicator is the normal version of the MACD indicator but normalized for volatility. It is normalized for volatility in order to compare momentum values across time and across tickers which the normal MACD indicator fails to do.

When the oversold/overbought range of 150 and -150 was determined, Alex tested where 95% of the data fell within the bands using the S&P500 price history as reference.

The MACD-V indicator is used to analyze normalized trends. If the MACD line is above 150 (light blue color), it is considered overbought. If the MACD line is below -150 (red color), it is considered oversold. Crossovers of the MACD area and the signal line are considered to be points of trend changes as well.
Release Notes
A volatility indicator is used to measure the magnitude and instability of price changes in financial markets or a specific asset. It is typically used to assess market risk. The higher the volatility, the greater the fluctuation in asset prices, and, consequently, the higher the risk.

Volatility indicators are crucial for investors and traders because they help them understand market uncertainty and risk, enabling them to make more informed investment decisions. Today, I'm introducing the Dynamic Volatility Indicator, which measures volatility and can also predict sharp rises and falls through color coding.

This indicator combines two technical indicators: Dynamic Volatility (DV) and Average True Range (ATR), providing warnings about sharp price movements through color changes. DV has a slow but relatively smooth response, while ATR has a fast but more oscillating response. By utilizing their complementary characteristics, it's possible to construct a structure similar to the MACD's fast-slow line structure. To achieve fast-slow lines for DV and ATR, we first need to unify their coordinate axes by normalizing them. Then, whenever the ATR's white line crosses above the DV's purple line, with both curves rapidly breaking through the 0.2 threshold, sharp rises or falls are likely imminent.

However, it is important to note that relying solely on the height and direction of these two lines is insufficient to determine the direction of sharp price movements. They only assess the trend of volatility and cannot determine whether it's a bull or bear market. To address this, I've added a gradient background color. When the color gradually turns warm (red), it indicates a sharp fall; conversely, when the color tends towards cool colors (turquoise), it indicates a sharp rise. The color background will not appear in sideways consolidation areas, helping you avoid unnecessary trades that would only waste your funds.
Release Notes
Three moving averages are incorporated, and you can choose their length and type.
ADXATRDirectional Movement Index (DMI)DMIMoving Average Convergence / Divergence (MACD)macdcrossMoving AveragessqueezevixfixXTL

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer