Scanning for Choppiness Index extreme


Category:
0
0

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);

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 6, 2021 2:02 pm
223 views
0
Private answer

Change the following line from plot to def:

plot CI = if CIx == CIx.CI3 then CI3 else CI2;

Then delete all the lines that come after that.

Then add the following line for your scan signal:

plot scan = CI > 60.0;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 6, 2021 5:42 pm