HeikinAshiDiff indicator in TOS

D

drho

New member
VIP
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.

THINKSCRIPT

Code:
#
# 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;

HADiff.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
ZeroLine.SetDefaultColor(GetColor(5));


# END

 
inthefutures

inthefutures

Active member
HADiff.assignvaluecolor(if HADiff > HADiff[1] then color.GREEN else color.RED);
 
D

drho

New member
VIP
inthefutures, Thank you so much. I know it was something easy for you coders.

 
H

HighBredCloud

Well-known member
VIP
@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

Top