TradingView
RedKTrader
3 Th01 2021 17:04

RedK_xMACD: Extending the classic MACD with a simple filter 

Invesco QQQ Trust, Series 1NASDAQ

Mô tả

This is a simple concept that attempts to squeeze more price action insights from the classic MACD
we add a 3rd (longer length, slower) Moving Average line that acts as a trend filter - so whenever we are ("we" = the price and the 2 other MAs) are above that filter line, we consider ourselves to be in the up-trend territory, and vica versa .. so the MACD calculation here - that is represented by the main (reg/green) line in the plot - will represent the distance between the slow MA and the filter MA - when that MACD line crosses the zero axis up or down, that represents the trand reversing from one direction to the other.

A signal line (a smoothed version of that MACD line) is still added for 2 reasons
1 - the signal line makes it easy to see if an eminent trend reversal is to be expected
2 - to stay visually-consistent with the classic MACD :)

the distance (or delta) between the other 2 MAs continues to reflect an indication of the short-term momentum and is what the histogram represents.
we still have the benefit of the convergence/diversion between the price itself and the histogram similar to the classic MACD
this MACD version will also clearly show how price and momentum action will lead the trend -- i know that's a big discussion topic :)

i added a classic MACD at the bottom panel, and used the same length settings (fast / slow) for side-by-side comparison

i coded this when i found that i use 3 moving averages all the time during my chart analysis, and while i'm a big fan of the classic MACD, i wanted to find a simple way to get my MACD to reflect what the 3 MAs on the price chart show. turned out to be insightful - i hope other fellow traders may find this useful

the code is simple and i started it from the built-in MACD in TradingView. Other annotations are added to the chart here as i believe this will better explain how the eXtended MACD works
- there are 4 reversals that occur in that chart, and i chose to show one in step-by-step fashion.

if more explanation is needed to how this can be used, pls let me know in the comments.



Bình luận
VonnyFX
RedKTrader
@VonnyFX, thank you 🙏
dahliax86
very very good sir. this indicator make me more profit now .Thank you.
RedKTrader
@dahliax86, glad that this is valuable to you - good luck.
DjjCI8i2
Great work! Basically, the histogram uses a shorter period, but the MACD line is calculated closer to the classic period of fast = 12, slow = 26 (or in the above case round figures fast = 10, slow = 20). Therefore, the histogram measures the shortest period, and the MACD crossover Signal line uses the longer period.

Curious, in following your work, have noticed creative use of Weighted Moving Averages. While the idea of using alternative moving averages on the classic MACD is not new, curious as to why you might not use a wma() on the fast/slow/filter calculations? Of course the classic MACD uses a sma() on the signal line, and in this script its been changed to an ema().
RedKTrader
@philippelemiere, thank you for your feedback and glad if you find this work useful ... to answer your questions:

- i like to use WMA because it provides a great balance between simplicity, smoothness and responsiveness - besides in my view, it's the best to represent the "relative importance" nature of price data (where the most recent point is more important than the one before, which is more important than the one before, and so on)

- why used EMA here, it depends on what MA's you originally use on your top chart - i look at 3 EMAs of lengths most common to other traders to find signals and expected swing levels (like 5, 10, 20), so that's what i have in the xMACD .. the xMACD basically interprets these EMAs from the top chart and shows them as a lower indicator that can provide more insights.
DjjCI8i2
@RedKTrader, nicely answered - really helped understand your xMACD!

In the main chart example to this post, the three ema's (5, 10, 20) overlaying the price data are clearly linked to the xMACD indicator, showing how the convergence of the histogram may effectively lead sentiment change.

Experienced minor confusion because have been using your fantastic RedK Ribbon v2 and its Zero-lag MA feature. Recognize trading styles vary, and taking the spirit of the conversation, a playful script tweak might read:

// Calculations
fast_ma = wma(src, fast_length)
slow_ma = ema(src, slow_length)
filter_ma = ema(src, filter_length)

... if perhaps using an even faster MA. Just a thought, but what if it called a ZLMA function:

fast_ma = ZLMA(src, fast_length)

...? Could be a nice alternative to other styles of zero-lag MACD's out there.
RedKTrader
@philippelemiere, totally possible .. when this is an indicator that *you* will use in your own trading, then change it in any way that suits you .. you do not have to take someone else's method or style ..

good luck.
dinhhuonggf
Very good job Bro!
RedKTrader
@dinhhuonggf, thank you... :)
Thêm nữa