RSI CANDLES

BULLFIZZ

Member
Platform
  1. Thinkorswim
@barbaros Can you please convert this trading view script to TOS?
I want the candles to be green above 50 level and Red below 50 level, the Length should also be 50
Thanks a lot.


// With levels candle border must be removed for better view
// By Glaz
study(title="RSI Chart Bars",overlay = true, shorttitle="RSI Bars")
src = close, len = input(14, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

//coloring method below

src1 = close, len1 = input(70, minval=1, title="UpLevel")
src2 = close, len2 = input(30, minval=1, title="DownLevel")
isup() => rsi > len1
isdown() => rsi < len2
barcolor(isup() ? green : isdown() ? red : na )
 

barbaros

Administrator
Staff member
Here you go.

Code:
## Converted for https://b4indicators.com/threads/rsi-candles.294/

input src = close;
input len = 50;
input avgType = AverageType.EXPONENTIAL;
input len1 = 50;
input len2 = 50;

def NetChgAvg = MovingAverage(avgType, src - src[1], len);
def TotChgAvg = MovingAverage(avgType, AbsValue(src - src[1]), len);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);

AssignPriceColor(if RSI > len1 then Color.GREEN else if RSI < len2 then Color.RED else Color.CURRENT);
 

BULLFIZZ

Member
Here you go.

Code:
## Converted for https://b4indicators.com/threads/rsi-candles.294/

input src = close;
input len = 50;
input avgType = AverageType.EXPONENTIAL;
input len1 = 50;
input len2 = 50;

def NetChgAvg = MovingAverage(avgType, src - src[1], len);
def TotChgAvg = MovingAverage(avgType, AbsValue(src - src[1]), len);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);

AssignPriceColor(if RSI > len1 then Color.GREEN else if RSI < len2 then Color.RED else Color.CURRENT);


@barbaros Im back again;) can we please get a scan based on this script? Scan when candles are in Red or Green ?
Thank you soo much
 

barbaros

Administrator
Staff member
@barbaros Im back again;) can we please get a scan based on this script? Scan when candles are in Red or Green ?
Thank you soo much
Scan should be easy. RSI is a plot output for the indicator. You can use the indicator in your scan and set the condition as "value greater than" with len1 value or "value less than" with len2 value.
 
Top