Why not, but the heatmap color is defined by the value of the indicator of X period (X is increased until the end of the defined scale). While an RSI has only 1 period in his setting, MACD has 3 (short term period, long term period and signal line period), here is a rough version of what can be done:
//PRC_MACD multiperiods HeatMap | indicator
//Plot an heatmap of the MACD range of periods
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// --- settings
maxscale=200 //end period of the loop
ShortPeriod=12
LongPeriod=26
Step=10 //period step of the loop
// --- end of settings
iShortPeriod = ShortPeriod
iLongPeriod = LongPeriod
hh=highest[100](macd[190,200,9])
ll=lowest[100](macd[190,200,9])
irange=hh-ll
while iLongPeriod<=maxscale do
// --- indicator calculation
osc = macd[ishortperiod,ilongperiod,9]
// -----
//result=abs((osc/pointsize)/irange)*100
result = osc/pointsize
G = (abs(result)/irange)*100
R = 200-g
//R = max(0,50+(200-(result-50)*12))
//G = max(0,50+(200+(result-50)*12))
drawtext("■",barindex,ilongperiod,dialog,bold,18) coloured(min(r,255),min(g,255),0)
//drawtext("#result#",barindex,ilongperiod,dialog,bold,12)
ishortPeriod=max(shortperiod,iShortPeriod+Step) //increase indicator period for next loop iteration
ilongPeriod=max(longperiod,ilongPeriod+Step) //increase indicator period for next loop iteration
wend
return shortperiod,maxscale//,result coloured(0,0,0,0)//,r as "r",irange as "range", osc
In this case I’m increasing both short and long moving average at the same time and with the same step. The MACD is not bounded, so in order to color the heatmap, i’m using a scale based upon the highest and lowest values of MACD during the last 100 periods.