#CCI-Stoch-Cross
#Jim Pyle
#####
input length = 14;
input over_sold = -100;
input over_bought = 100;
input showBreakoutSignals = no;
#####
# Define CCIs
def price = close + low + high;
def linDev = lindev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;
def CCI_Lo = CCI crosses above over_sold;
def CCI_Hi = CCI crosses below over_bought;
def CCI_Mid = CCI crosses Zeroline;
def CCI_Lo_5 = CCI_Lo[1] or CCI_Lo[2] or CCI_Lo[3] or CCI_Lo[4] or CCI_Lo[5];
def CCI_Hi_5 = CCI_Hi[1]or CCI_Hi[2]or CCI_Hi[3]or CCI_Hi[4]or CCI_Hi[5];
def CCI_Mid_5 = CCI_Mid[1]or CCI_Mid[2]or CCI_Mid[3]or CCI_Mid[4]or CCI_Mid[5];
#####
AddLabel(yes, if CCI_Hi_5 then “a CCI High” else if CCI_Lo_5 then “b CCI Low” else if CCI_Mid_5 then “c CCI Mid” else“No Crossing”,color.white);