How would I take this study script for Choppiness Index and create a scan to return all stocks >60?
# { CI: Choppiness Index }
declare lower;
# Inputs: Len(14);
input Len = 14;
input CIx = {default CI3, CI2};
#Plot1(100 * Log(Summation(TrueRange,Len)/(Highest(C[1],Len) – Lowest(C[1],Len))/Log(Len)), “CI2”);
def CI2 = 100 * log( Sum( TrueRange(high,close,low),Len)
) / ( Highest(close[1],Len) – Lowest(close[1],Len))
/ log(Len);
def CI3 = ( ( log(Sum(TrueRange(high,close,low),Len) /
(
Highest(if high >= close[1] then high else
close[1],Len) –
Lowest( if low <= close[1] then low else close[1],Len)
)
) / log(10)
) / (log(Len)/log(10))
) * 100;
plot CI = if CIx == CIx.CI3 then CI3 else CI2;
CI.AssignValueColor( Color.Blue);
# Plot2(60,”60Li”);
plot line60 = 61.8;
line60.AssignValueColor(Color.DARK_GREEN);
# Plot3(35,”35Li”);
plot line35 = 38.2;
line35.AssignValueColor(Color.BLACK);
# Plot4(25,”25Li”);
plot line25 = 25;
line25.AssignValueColor(Color.DARK_RED);
Like this:
Like Loading...