vkno422

MACD 4C

7803 22 2429
4 Coloured MACD
lime = positive rising
green = positive descending
red = positive rising
maroon = positive descending
Remove from Favorite Scripts Add to Favorite Scripts
study(shorttitle = "MACD 4C", title = "4 colour MACD")
fastMA = input(title="Fast moving average", type = integer, defval = 12, minval = 7)
slowMA = input(title="Slow moving average", type = integer, defval = 26, minval = 7)
lastColor = yellow
[currMacd,_,_] = macd(close[0], fastMA, slowMA, 9)
[prevMacd,_,_] = macd(close[1], fastMA, slowMA, 9)
plotColor = currMacd > 0 
    ? currMacd > prevMacd ? lime : green 
    : currMacd < prevMacd ? maroon : red
plot(currMacd, style = histogram, color = plotColor, linewidth = 3)
plot(0, title = "Zero line", linewidth = 1, color = gray)
ski4ever PRO
2 years ago
Copied and pasted the script into the script editor.
Save, and Add to Chart - voilà!
Thanks Victor!
+3 Reply
Les.C
2 years ago
Thanks Victor!
+1 Reply
BWilliam
2 years ago
I love using MACD. This usage is the closest direct correlation to price/candle changes.
Reply
vkno422 PRO
2 years ago
To get the script add it to your favorite sripts by clicking the star next to the script. It should then show blue.
Then click on "indicators" above your chart (you need to click on the word rather than the arrow next to it).
You will see a group on the left called "favorites". The MACD 4C should show in there. Just click on it to add it to the chart.
+1 Reply
BWilliam vkno422
2 years ago
Thanks Vic... I finally got it to work.
+1 Reply
MarkLangley PRO vkno422
2 years ago
Thank you Victor
+2 Reply
Money_Snake
a year ago
Thank you Victor, MACD added
Reply
samehanwer1000
a year ago
great
Reply
jacobtrading68
a year ago
Thanks Victor!
Reply
Why does the MACD differs from standard MACD (try with the one by default) ?

I don't get it by looking the code.
Reply
Kantardziski PRO J.Livermore
10 months ago
I cant tell either.
Reply
Kantardziski PRO Kantardziski
10 months ago
Well actually, it is something to do with the portion of script changing the colors of macd... Take that out and it performs normally.
Reply
Kantardziski PRO Kantardziski
10 months ago
As a prudent person, it is difficult to think nearly 1000 likes and this has slipped by ever user... in other words, its certainly possible I am missing something.
Reply
vkno422 PRO J.Livermore
10 months ago
It's very simple really. In most MACD's the MACD value is shown as a line, here it is the MACD value that is shown as a histogram.
Reply
balong
8 months ago
Thank you very much sir . I got it!!!!
Reply
Dejan78
7 months ago
Tnx.
Reply
JoseNeto PRO
4 months ago
Good Job
Reply
Tim8917 PRO
3 months ago
Thanks Victor
Reply
Joe_555
2 months ago
How do I get this indicator in my MT4 platform ?
Reply
vkno422 PRO Joe_555
2 months ago
@Joe_555, There are different MACD's available for MT4.
This is specifically written for TradingView and uses their scripting language (PineScript).
So this specific version is not available for MT4.
Reply
Joe_555 vkno422
2 months ago
@vkno422, I manage to download Histogram MACD indicator for MT4 and the settings are 12, 26,9 (similar to your settings) , but it look very different from how it appears in TradingView. Any reason why? or is there any setting that I got it wrong, appreciate your feedback
Reply
vkno422 PRO Joe_555
2 months ago
@Joe_555, Most likely it is that I am showing the MACD as histogram. Most MACD's show the MACD as a line.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out