JustUncleL

MACD DEUTER 2 colour by JustUncleL

321 0 40
This version of the coloured MACD is used in a number of my chart set ups.
Remove from Favorite Scripts Add to Favorite Scripts
//@version2
//Based on MACD for colour blind people by cfhrtd
//Modified by JustUncleL for 2 colours and added signal length.
//
study(title = "MACD DEUTER 2 colour by JustUncleL", shorttitle = "2 colour MACD by JustUncleL")
fastMA = input(title="Fast MA Length", type = integer, defval = 5, minval = 2)
slowMA = input(title="Slow MA Length", type = integer, defval = 15, minval = 7)
signal = input(title="Signal Length",type=integer,defval=1,minval=1)
//
[currMacd,_,_] = macd(close[0], fastMA, slowMA, signal)
[prevMacd,_,_] = macd(close[1], fastMA, slowMA, signal)
plotColor = currMacd > 0 
    ? currMacd > prevMacd ? green : red
    : currMacd < prevMacd ? red : green
plot(currMacd, style = histogram, color = plotColor, linewidth = 4)
plot(currMacd, style = line, color = blue, linewidth = 2)
hline(0, title = "Zero line", linewidth = 2, color = gray)
//EOF
Ideas Scripts Chart
United States
United Kingdom
India
España
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 Billing Sign Out