TRIN indicator not matching $TRIN plot

D

dolomick

Member
So I wanted a lower TRIN indicator and found this on the oneDrive. But on March 16th, we spiked to around 15 on the TRIN (just input $TRIN into the ticker field on a chart to see). If I look at this indicator, it does not show that for the same date. Can someone help explain why that would be?

Code starts here....

Code:
#Here is TRIN as lower study. I have inverted it to make it easier to understand, so spike above 2 is overbought (plot will turn red) and spike below 0.5 is oversold #(plot will turn green). It will draw horizontal line at 2 in pink and at 0.5 in light green to indicate overbought and oversold levels. 

#In regular TRIN it is upside down, spike above 2 is oversold and spike below 0.5 is overbought. 

declare lower; 

def UVOL = close(“$UVOL”); 
def DVOL = close(“$DVOL”); 
def ADV = close(“$ADVN”); 
def DECL = close(“$DECN”); 

plot TRIN = (DECL/ADV)/(DVOL/UVOL); 
TRIN.SetStyle(Curve.FIRM); 
TRIN.AssignValueColor(if TRIN >= 2 then Color.RED else if TRIN <= 0.5 then Color.GREEN else Color.GRAY); 

plot ZeroLine = 1; 
        ZeroLine.AssignValueColor(Color.LIGHT_GRAY); 

plot UB = 2; 
        UB.AssignValueColor(Color.PINK); 

plot LB = 0.5; 
        LB.AssignValueColor(Color.LIGHT_GREEN);
 
S

SparkyFlary

Member
Do you have the regular version that is not inverted?
 
BenTen

BenTen

Administrative
Staff
VIP
Why don't use just use the actual TRIN index?
 

Similar threads

Top