//--------------------------------------------------------//
//-----Inputs---------------------------------------------//
fastlength=12
slowlength=26
signalLength=9
src=close
levelHisto=50
//--------------------------------------------------------//
//-----MACD-----------------------------------------------//
fastema=average[fastlength,1](src)
slowema=average[slowlength,1](src)
mymacd=fastema-slowema
signal=average[signalLength,1](mymacd)
histo=mymacd-signal
//--------------------------------------------------------//
//-----------New Histogram--------------------------------//
newHistoH=levelHisto+histo
newHistoL=levelHisto
if newHistoH>levelHisto then
r=0
g=255
else
r=255
g=0
endif
DRAWCANDLE(newHistoL, newHistoH, newHistoL, newHistoH)coloured(r,g,0)
//--------------------------------------------------------//
return mymacd as "MACD" coloured("red"), signal as "Signal"coloured("blue"), levelHisto as "Level Hist", 0 as "Zero"