Hi, i manage to find this code created by Pete Hahn. It plots the UpArrow these two conditions are met, Price pulls back to 20MA and CCI is below 100. What i did was to apply this indicator and scan together with a uptrending watchlist and the results are satisfactory. You may change the Moving Average by changing the value of ma1.
Hope this is useful.
Thanks
Code:
input length = 14;
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 ma1 = Average(close, 20);
def priceAboveMa1 = close > ma1;
def atLeastFiveBarsAboveMa1 = Lowest(priceAboveMa1, 5) > 0;
def firstTouchInFiveBars = atLeastFiveBarsAboveMa1[1] and close < ma1;
plot signal = if firstTouchInFiveBars and CCI < 100 then low else Double.NaN;
signal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
signal.SetDefaultColor(Color.GREEN);
Hope this is useful.
Thanks