```
# Multiple RSI Security Comparison
#
# Inspired by horserider
# 2020-02-27
#
declare lower;
input averageType = AverageType.WILDERS;
input length = 7;
input t1 = "EBAY"; #hint BLUE
input t2 = "WMT"; #hint CYAN
input t3 = "AMZN"; #hint LIGHT_GRAY
input t4 = "COST"; #hint DARK_ORANGE
input t5 = "BABA"; #hint PINK
input t6 = "BBY"; #hint VIOLET
input t7 = "TGT"; #hint YELLOW
def t1_vol = volume(t1);
def t2_vol = volume(t2);
def t3_vol = volume(t3);
def t4_vol = volume(t4);
def t5_vol = volume(t5);
def t6_vol = volume(t6);
def t7_vol = volume(t7);
def t1_o = open(t1);
def t2_o = open(t2);
def t3_o = open(t3);
def t4_o = open(t4);
def t5_o = open(t5);
def t6_o = open(t6);
def t7_o = open(t7);
def t1_h = high(t1);
def t2_h = high(t2);
def t3_h = high(t3);
def t4_h = high(t4);
def t5_h = high(t5);
def t6_h = high(t6);
def t7_h = high(t7);
def t1_l = low(t1);
def t2_l = low(t2);
def t3_l = low(t3);
def t4_l = low(t4);
def t5_l = low(t5);
def t6_l = low(t6);
def t7_l = low(t7);
def t1_c = close(t1);
def t2_c = close(t2);
def t3_c = close(t3);
def t4_c = close(t4);
def t5_c = close(t5);
def t6_c = close(t6);
def t7_c = close(t7);
#RSI Wrapper
def t1_NetChgAvg = MovingAverage(averageType, t1_c - t1_c[1], length);
def t1_TotChgAvg = MovingAverage(averageType, AbsValue(t1_c - t1_c[1]), length);
def t1_ChgRatio = if t1_TotChgAvg != 0 then t1_NetChgAvg / t1_TotChgAvg else 0;
def t2_NetChgAvg = MovingAverage(averageType, t2_c - t2_c[1], length);
def t2_TotChgAvg = MovingAverage(averageType, AbsValue(t2_c - t2_c[1]), length);
def t2_ChgRatio = if t2_TotChgAvg != 0 then t2_NetChgAvg / t2_TotChgAvg else 0;
def t3_NetChgAvg = MovingAverage(averageType, t3_c - t3_c[1], length);
def t3_TotChgAvg = MovingAverage(averageType, AbsValue(t3_c - t3_c[1]), length);
def t3_ChgRatio = if t3_TotChgAvg != 0 then t3_NetChgAvg / t3_TotChgAvg else 0;
def t4_NetChgAvg = MovingAverage(averageType, t4_c - t4_c[1], length);
def t4_TotChgAvg = MovingAverage(averageType, AbsValue(t4_c - t4_c[1]), length);
def t4_ChgRatio = if t4_TotChgAvg != 0 then t4_NetChgAvg / t4_TotChgAvg else 0;
def t5_NetChgAvg = MovingAverage(averageType, t5_c - t5_c[1], length);
def t5_TotChgAvg = MovingAverage(averageType, AbsValue(t5_c - t5_c[1]), length);
def t5_ChgRatio = if t5_TotChgAvg != 0 then t5_NetChgAvg / t5_TotChgAvg else 0;
def t6_NetChgAvg = MovingAverage(averageType, t6_c - t6_c[1], length);
def t6_TotChgAvg = MovingAverage(averageType, AbsValue(t6_c - t6_c[1]), length);
def t6_ChgRatio = if t6_TotChgAvg != 0 then t6_NetChgAvg / t6_TotChgAvg else 0;
def t7_NetChgAvg = MovingAverage(averageType, t7_c - t7_c[1], length);
def t7_TotChgAvg = MovingAverage(averageType, AbsValue(t7_c - t7_c[1]), length);
def t7_ChgRatio = if t7_TotChgAvg != 0 then t7_NetChgAvg / t7_TotChgAvg else 0;
plot t1_rsi = 50*(t1_ChgRatio+1);
plot t2_rsi = 50*(t2_ChgRatio+1);
plot t3_rsi = 50*(t3_ChgRatio+1);
plot t4_rsi = 50*(t4_ChgRatio+1);
plot t5_rsi = 50*(t5_ChgRatio+1);
plot t6_rsi = 50*(t6_ChgRatio+1);
plot t7_rsi = 50*(t7_ChgRatio+1);
t1_rsi.SetDefaultColor(Color.BLUE);
t2_rsi.SetDefaultColor(Color.CYAN);
t3_rsi.SetDefaultColor(Color.LIGHT_GRAY);
t4_rsi.SetDefaultColor(Color.DARK_ORANGE);
t5_rsi.SetDefaultColor(Color.PINK);
t6_rsi.SetDefaultColor(Color.VIOLET);
t7_rsi.SetDefaultColor(Color.YELLOW);
```