// Heikin-Ashi definition
once xOpen = open
xClose = (open + close + high + low) / 4
if barindex > 0 then
xOpen = (xOpen + xClose[1]) / 2
endif
//xLow = min(low,min(xClose,xOpen))
//xHigh = max(high,max(xClose,xOpen))
//xTypic = (xHigh + xLow + xClose) / 3
//xMed = (xHigh + xLow) / 2
//xRange = xHigh - xLow
//
Bullish = xClose > xOpen
Bearish = xClose < xOpen
Red2Green = (Bullish AND Bearish[1])
Green2Red = (Bearish AND Bullish[1])
//
MyMACD = ExponentialAverage[12](xClose) - ExponentialAverage[26](xClose)
MySignalLine = ExponentialAverage[9](MyMACD)
MyHisto = MyMACD - MySignalLine
//
CrossOVER = MyMACD CROSSES OVER MySignalLine
CrossUNDER = MyMACD CROSSES UNDER MySignalLine