# CCI Buy Sell Signals
# tomsk
# 1.12.2020
declare lower;
input length = 14;
input over_sold = -100;
input over_bought = 100;
input showBreakoutSignals = no;
def price = close + low + high;
def linDev = lindev(price, length);
plot CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
plot OverBought = over_bought;
plot ZeroLine = 0;
plot OverSold = over_sold;
plot UpSignal = if CCI crosses above 0 then 0 else Double.Nan;
plot DownSignal = if CCI crosses below 100 then 100 else Double.Nan;
CCI.setDefaultColor(GetColor(9));
OverBought.setDefaultColor(GetColor(5));
ZeroLine.setDefaultColor(GetColor(5));
OverSold.setDefaultColor(GetColor(5));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpSignal.SetLineWeight(5);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownSignal.SetLineWeight(5);
Alert(UpSignal, "CCI crosses above 0", Alert.BAR, Sound.Ring);
Alert(DownSignal, "CCI crosses below 100", Alert.BAR, Sound.Bell);
AddLabel(UpSignal, "CCI crosses above 0", Color.GREEN);
AddLabel(DownSignal, "CCI crosses below 100", Color.RED);
# End CCI Buy Sell Signals
# ToS CCI with downsignla changed to cross below 100 the overbought line.
# Horserider 1/12/2020 on request from jimmyrr
declare lower;
input length = 14;
input over_sold = -100;
input over_bought = 100;
input showBreakoutSignals = no;
def price = close + low + high;
def linDev = lindev(price, length);
plot CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
plot OverBought = over_bought;
plot ZeroLine = 0;
plot OverSold = over_sold;
plot UpSignal = if CCI crosses above ZeroLine then ZeroLine else Double.Nan;
plot DownSignal = if CCI crosses below OverBought then OverBought else Double.Nan;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
CCI.setDefaultColor(GetColor(9));
OverBought.setDefaultColor(GetColor(5));
ZeroLine.setDefaultColor(GetColor(5));
OverSold.setDefaultColor(GetColor(5));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
declare upper;
input cciLength = 14;
input cciAvgLength = 9;
input over_sold = -100;
input over_bought = 100;
def CCI = CCI(length = cciLength);
def CCIAvg = Average(CCI, cciAvgLength);
def OverBought = over_bought;
def OverSold = over_sold;
plot UpSignal = CCI crosses above oversold;
plot DownSignal = CCI crosses below overbought;
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
If I get a chance, I'll see if I can write a script that references the study above and places arrows at the high or low as an upper study...I appreciate the suggestion @rad14733, but the arrows do get a tad funky on the chart. Anyone else have suggestion on how to properly get the arrows to display on the main chart?
input length = 20;
input showBreakoutSignals = yes;
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;
input OverBought = 1;
input OverSold = -1;
plot UpSignal = if CCI crosses above OverBought then OverBought else Double.Nan;
plot DownSignal = if CCI crosses below OverSold then OverSold else Double.Nan;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
UpSignal.SetDefaultColor(Color.GREEN);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.RED);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
In a lower study can the Up and Down Arrows always appear at the very top of the Window?UpSignal.SetDefaultColor(Color.GREEN); UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); DownSignal.SetDefaultColor(Color.RED); DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Just change 100 to 200.@horserider hi. thank you for share with us, a quick question, i see the script have overbought 1 and oversold -1, that mean 100 and -100? can you do overbought 200 and oversold -200? thanks
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
M | Plot highest open interest strike price for current week | Questions | 1 | |
G | How do I plot a line for previous day closing price | Questions | 2 | |
N | Hide Connection of plot lines | Questions | 3 | |
C | How to plot 60min 20 Bar EMA on a 5min chart? | Questions | 1 | |
J | Im trying to make my stochastic plot hh and ll on my chart. | Questions | 0 |