• The price of VIP membership is increasing to $199 beginning June 1. Click here to lock in the current rate of $149.

HeikinAshiDiff indicator in TOS


New member
In TOS, there is an indicator HeikinAshiDiff (HAD). I observed this indicator and it follows the HA paint bars. When the HAD, is above the zero line, the chart candle is green and when it crosses below zero line the candle is red. I need some help in making the indicator to be green when rising and red when going lower. Or like a Histogram where up is green and down is red. Sometimes when the HAD indicator reverses before it approaches the zero line, it is warning that the paint bar is going to change soon. Thank you in advance.


# TD Ameritrade IP Company, Inc. (c) 2008-2020

declare lower;

input smoothingLength = 3;

def haclose = (open + high + low + close) / 4;
def haopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close[1]) / 2);
def diff = haclose - haopen;

plot HADiff = diff;
plot Avg = Average(diff, smoothingLength);
plot ZeroLine = 0;





Well-known member
@drho I don't know if this is right...IF the line is supposed to be RED below the 0 and GREEN above the ZERO than the pic you posted is off...Double check with HA candles...This more looks like the change in slope of the line...which reflects GREEN/RED...There is also a script that paints standard candles in HA format.

Similar threads