RSI from /YM 1 hr to Be Plotted on /ES chart

S

ssara

New member
Hello - I am looking at 1 HR chart for RSI and i want to plot /YM RSI OSC on /ES chart. Can someone help create that please.
 
T

tomsk

Well-known member
VIP
@ssara Here we go - this study plots the /YM RSI oscillator when you load /ES up on your charts or when you load any other chart for that matter

Code:
declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;

input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

def price = close(symbol = "/YM");
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 = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 
S

ssara

New member
Hello to move from RANGE bar to TIME bar how do i do that -- I want to drop USE this on RANGE bar but drop it on TIME bar. Is that possible.
 

Similar threads

Top