SpdPro_6252012
Not sure what this is but found it. Delete any of these if you don't want them public.
C ~
declare lower;
script Avg {
input price = close;
input length = 12;
input type = {None, default SMA, EMA, WLD, AMA};
plot Avg;
switch (type){
case None:
Avg = price;
case SMA:
Avg = Average(price, length);
case EMA:
Avg = ExpAverage(price, length);
case WLD:
Avg = WildersAverage(price, length);
case AMA:
Avg = MovAvgAdaptive(price, 2, 30, length);
}
}
input showCloud = Yes;
input avgType = {None, default SMA, EMA, WLD, AMA};
input length = 10;
input smooth = 5;
input LRlength = 100;
input over_Bought = -20;
input over_Sold = -80;
# 1-4 sets line style, otherwise no line
input line = 3;
def C = close;
def hh = Highest(high, length);
def ll = Lowest(low, length);
def result = if hh == ll then -100 else (hh - C) / (hh - ll) * (-100);
plot WR = if result > 0 then 0 else Avg(result, smooth, avgType);
WR.SetDefaultColor(Color.Gray);
plot OverSold = over_Sold;
OverSold.SetDefaultColor(Color.Gray);
plot OverBought = over_Bought;
OverBought.SetDefaultColor(Color.Gray);
plot LR = InertiaAll(WR, LRlength);
LR.AssignValueColor(if LR > LR[1] then color.green else color.red);
def mid = (over_Bought + over_Sold) / 2;
rec wrDir = compoundValue(1, if WR crosses above over_Bought then 1 else if WR crosses below over_Sold then -1 else wrDir[1], 0);
def isUp = wrDir > 0 and wrDir[1] <= 0;
def isDown = wrDir < 0 and wrDir[1] >= 0;
plot Up = if isUp then mid else Double.Nan;
Up.SetLineWeight(2);
Up.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Up.SetDefaultColor(Color.Cyan);
plot Down = if isDown then mid else Double.Nan;
Down.SetLineWeight(2);
Down.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Down.SetDefaultColor(color.Magenta);
def obUp = if showCloud and wrDir > 0 then OverBought else double.NaN;
def obDown = if showCloud and wrDir < 0 then OverBought else double.NaN;
# obUp cloud shown if last signal was up.
AddCloud(obUp, OverSold, color.green, color.green);
# obDown cloud shown if last signal was down.
AddCloud(obDown, OverSold, color.red, color.red);
def showLine = line > 0 and line < 5;
AddVerticalLine(showLine and isUp, "", color.green, line);
AddVerticalLine(showLine and isDown, "", color.red, line);