OPEN-SOURCE SCRIPT

P-MACD by DGT

Price and Moving Averages Convergence/Divergence, shortly named as P-MACD

P-MACD is a trend-following momentum indicator that shows the relationship between Price and Long-term Moving Average (PMACD), and the relationship between two Moving Averages (MAMACD). P-MACD is composed of two lines, and an histogram, showing price distance (convergence/divergence) to its Long-term MA (PMACD), showing short-term MA distance (convergence/divergence) to long-term MA (MAMACD), and a histogram showing the difference (momentum) between the PMACD and MAMACD
The PMACD is calculated by dividing the Price to Long-term Moving Average (200-period SMA/EMA) and finally smoothed with 9-period SMA/EMA
- PMACD Line Formula : (Price / SlowMovingAverage -1) * 100 and smoothed with 9-period SMA/EMA

The MAMACD is calculated by dividing the Short-term Moving Average (such as 20 SMA/EMA) to the Long-term Moving Average (such as 200-period SMA/EMA)
- MAMACD Line Formula : (FastMovingAverage / SlowMovingAverage -1) * 100

The Histogram is calculated by subscripting PMACD and MAMACD
- Formula : PMACD - MAMACD

Optional
Trend Cloud calculated based on fast and slow version of MAMACD

What to look for:

- Line Crosses: PMACD Line can function as a trigger(signal) for buy and sell signals. Buy when the PMACD crosses above the MAMACD line and sell - or short - when the PMACD crosses below the MAMACD line

- Base Crosses : PMACD and/or MAMACD crosses above or below Baseline is another way to indicate the trend and momentum. MAMACD crosses of Baseline, MAMACD positive or negative, reflects short-term moving average crosses the long-term moving average and similarly, PMACD crosses of BaseLine, PMACD positive or negative, reflects price crosses a long-term moving average

- Momentum: P-MACD helps investors understand whether the bullish or bearish movement in the price is strengthening or weakening displayed with a histogram which graphs the distance between the PMACD and MAMACD. Additionally, upward momentum is confirmed with a bullish crossover, which occurs when PMACD and/or MAMACD crosses above Baseline. Conversely, downward momentum is confirmed with a bearish crossover, which occurs when PMACD and/or MAMACD crosses below Baseline

- Distance: Prices high above the moving average (MA) or low below it are likely to be remedied in the future by a reverse price movement. The more distant the PMACD is above or below its baseline indicates that the distance between the Price and its SMA is growing (regarding PMACD, You may find a detailed article explained in “Price Distance to its MA” indicator by DGT) . Similarly the more distant the MAMACD is above or below its baseline indicates that the distance between the two SMAs is growing

- Trend : A rising P-MACD indicates an uptrend, while a declining P-MACD indicates a downtrend


MACD vs. P-MACD
MACD measures the relationship between two MAs, while the P-MACD measures both the relationship between price and its MA, and the relationship between two MAs. MAMACD Line of P-MACD If set to same moving average type and same lengths as in MACD will produce the same line as MACD line, only values are represented as percentage with MAMACD. Both measure momentum in a market, but, because they measure different factors, they differentiate from each other even if they have similarities in presentation. P-MACD provides additional insights, not only to MA relation but also to Price and MA relation

Warning: Moving Average are calculated based on past prices, so they are lagging. The longer the time period for the moving average, the greater the lag as well as less sensitive to price changes. This study implements usage of 200-period long-term moving average, which implies that the P-MACD will provide insight especially for long-term trades, more suited for long-term trades, usage of P-MACD for short-term trades is recommend with lower timeframes (1H or lower).

Indicators aim to generate a potential signal/indication of an upcoming opportunity, but, the Indicators themselves do not guarantee the future movement of a given financial instrument, and are most useful when used in combination with other techniques.

Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely

Disclaimer: The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd tradingview user liable for any possible claim for damages arising from any decision you make based on use of the script


200sma20smaDGTExponential Moving Average (EMA)Moving Average Convergence / Divergence (MACD)priceSimple Moving Average (SMA)

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm