//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