glendale ca usa
Posts: 97 since Sep 2017
Thanks Given: 11
Thanks Received: 88
|
declare lower;
#RSI_POINTS
input length = 44;#24
input length2 = 18;#8
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 100 * (ChgRatio + .5);
##plot OverSold = over_Sold;
##plot OverBought = over_Bought;
plot avg = wildersAverage(RSI, length2);
avg.setDefaultColor(color.white);
addcloud(rsi, avg, color.green, color.red);
addcloud(rsi, avg, color.green, color.red);
###plot line50 = 50;
###line50.setStyle (curve.long_DASH);
###line50.setDefaultColor(color.gray);
RSI.DefineColor("OverBought", GetColor(1));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", color.red);
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
RSI.setLineWeight(2);
#percent_RSI
input RSI_length2 = 14;
input RSI2_length = 14;
#input over_bought = 80;
#input over_sold = 20;
input RSI_average_type = AverageType.WILDERS;
input RSI_price = close;
input KPeriod = 44;#14
input DPeriod = 3;
input slowing_period = 1;
#input averageType = AverageType.SIMPLE;
#input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
def RSI2 = RSI(price = RSI_price, length = RSI_length2, averageType = RSI_average_type);
def avg1 = wildersAverage(rsi, RSI2_length );
def FullK = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullK;
##FullK.setDefaultColor(color.yellow);
plot FullD = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullD;
FullD.setDefaultColor(color.yellow);
plot UpSignal_ = if FullD> FullD[1] AND FullD > 70 then FullD else Double.NaN;
plot DownSignal_ = if FullD< FullD[1] AND FullD < 30 then FullD else Double.NaN;
UpSignal_.SetDefaultColor(Color.BLUE);
UPSignal_.SETLineWeight(2);
UpSignal_.SetPaintingStrategy(PaintingStrategy.POINTS);
DownSignal_.SetDefaultColor(Color.YELLOW);
DOWNSignal_.SETLineWeight(2);
DownSignal_.SetPaintingStrategy(PaintingStrategy.POINTS);
plot UpSignal2_ = if FullD>75 then FullD else Double.NaN;
plot DownSignal2_ = if FullD<25 then FullD else Double.NaN;
UpSignal2_.SetDefaultColor(Color.CYAN);
UPSignal2_.SETLineWeight(4);
UpSignal2_.SetPaintingStrategy(PaintingStrategy.POINTS);
DownSignal2_.SetDefaultColor(Color.red);
DOWNSignal2_.SETLineWeight(4);
DownSignal2_.SetPaintingStrategy(PaintingStrategy.POINTS);
#####
input lengthR = 50;
input lengthp2 = 8;
input lengthp3 = 5;
#input over_Sold = 20;
#input over_Bought = 80;
def highest = Highest(high, lengthR);
def divisor = highest - Lowest(low, lengthR);
DEF "%R" = 1* if divisor equals 0 then 0 else 100 - 100 * (highest - close) / divisor;
plot line50 = 50;
line50.setStyle (curve.MEDIUM_DASH);
line50.setDefaultColor(color.gray);
line50.AssignValueColor(if "%R" > over_Bought then color.CYAN else if "%R" < over_Sold then color.red else color.gray);
line50.setLineWeight(4);
###ADDCLOUD(line50, slowRSI, color.red, color.green);
###
plot OverSold = over_Sold;
overSold.setDefaultColor(color.gray);
OverSold.AssignValueColor(if "%R" > over_Bought then color.CYAN else if "%R" < over_Sold then color.red else color.gray);
plot OverBought = over_Bought;
overBought.setDefaultColor(color.gray);
OverBought.AssignValueColor(if "%R" > over_Bought then color.CYAN else if "%R" < over_Sold then color.red else color.gray);
overBought.hidebubble();
#code end
|