Hello all fellow traders, so I have these 2 indicators id like to combine except when I do I get an error on "Input-Price" all the way at the bottom and I've tried to work things around and still can't get it to work. bellow are the 2 codes separated and need help combining them. can someone point me in the right direction please. Thank you for your time.
1st lower indicator
2nd Lower indicator
1st lower indicator
Ruby:
input channel_length = 10; #10
input average_length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = hlc3;
def esa = ExpAverage(ap, channel_length);
def d = ExpAverage(AbsValue(ap - esa), channel_length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, average_length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
plot zero = 0;
zero.SetDefaultColor(Color.GRAY);
plot obLevel1 = over_bought_1;
obLevel1.SetDefaultColor(Color.DOWNTICK);
obLevel1.SetStyle(Curve.SHORT_DASH);
plot obLevel2 = over_bought_2;
obLevel2.SetDefaultColor(Color.DOWNTICK);
obLevel2.SetStyle(Curve.SHORT_DASH);
plot osLevel1 = over_sold_1;
osLevel1.SetDefaultColor(Color.LIGHT_GREEN);
osLevel1.SetStyle(Curve.SHORT_DASH);
plot osLevel2 = over_sold_2;
osLevel2.SetDefaultColor(Color.LIGHT_GREEN);
osLevel2.SetStyle(Curve.SHORT_DASH);
plot wt1_1 = wt1;
wt1_1.SetDefaultColor(Color.CYAN);
plot wt2_1 = wt2;
wt2_1.SetDefaultColor(Color.MAGENTA);
def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;
plot Signal = if signal1 then (signal1 * over_sold_2) else Double.NaN;
Signal.SetDefaultColor(Color.GREEN);
Signal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Signal.SetLineWeight(2);
Signal.HideTitle();
def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;
plot Signal2_ = if signal2 then (signal2 * over_bought_2) else Double.NaN;
Signal2_.SetDefaultColor(Color.RED);
Signal2_.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Signal2_.SetLineWeight(2);
Signal2_.HideTitle();
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
plot Histogram = Double.NaN;
plot VolComp = Double.NaN;
plot SqueezeAlert = Double.NaN;
2nd Lower indicator
Ruby:
declare lower;
input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;
def K = (Highest(high, Klength) + Lowest(low, Klength)) /
2 + ExpAverage(close, Klength);
plot Momo = Inertia(price - K / 2, Klength);
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.SetLineWeight(3);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.Blue
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
def SD = StDev(close, Slength);
def Avg = Average(close, Slength);
def ATR = Average(TrueRange(high, close, low), Slength);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.RED);
plot zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.POINTS);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.GREEN);
AddLabel(!IsNaN(Squeeze), "Squeeze", if IsAscending(Momo)
then Color.GREEN
else Color.RED);
# End Code - Momentum Squeeze
AddVerticalLine(!IsNaN(squeeze[1]) and IsNaN(squeeze), "Fired", Color.RED, Curve.FIRM);
#ADDED Volume###################################################################
#Colored Volume By Ethans080901
#Mod TroyX-8-17-18
#If today's closing price and volume is greater than 'n' days ago, color green
#If today's closing price is greater than 'n' days ago but volume is not, color blue
#If today's closing price is less than 'n' days ago, color orange
#If today's closing price is less than 'n' days ago but volume is not, color red
input n = 10;
def CN = Average(close, n);
def VN = Average(volume, n);
def G = close > CN and volume > VN ;
def B = close > CN and volume == VN;
def O = close < CN and volume == VN;
def R = close < CN and volume >= VN;
#Added volume Label
AddLabel( G, "Bullish Volume" , Color.CYAN); #Strong Bull
AddLabel( B, "Bullish Volume" , Color.BLUE); #Weak Bull
AddLabel( O, "Bearish Volume" , Color.YELLOW); #Weak Bear
AddLabel( R, "Bearish Volume" , Color.ORANGE); #Strong Bear
#How to use:
#Buy on Green or Blue
#Sell on Yellow or Orange
#End
Last edited by a moderator: