ARSI - Adaptive Relative Strength Index for ThinkorSwim

rad14733

Well-known member
VIP
The ARSI is an upper indicator that works like a moving average but based on RSI... It works well for scalping which is what drew my original interest... While the standard RSI uses a length of 14 it is recommended to use a shorter length for this indicator and 3 is a good length for scalping on lower timeframes...

I will be adding more details as well as more images as time allows...

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.GREEN); #GREEN
arsi.DefineColor("DownTrend", Color.RED); #RED
arsi.SetLineWeight(3);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

AddLabel(showLabel, "ARSI: " + arsi, if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

plot bull = arsi[2] > arsi[1] and arsi > arsi[1];
bull.SetDefaultColor(Color.GREEN);
bull.SetlineWeight(1);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetHiding(!showReversals);

plot bear = arsi[2] < arsi[1] and arsi < arsi[1];
bear.SetDefaultColor(Color.RED);
bear.SetLineWeight(1);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetHiding(!showReversals);

# END - ARSI

CL1ciE4.png
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thanks @rad14733, I like this! I tried to insert an arrow at the bar where the color flips, my code is below, but of course is places the arrows accross the entire stretch of color. What can I change in order to just have the arrow under the color flipped bar?

Code:
plot Bull = arsi > arsi[1];
plot Bear = arsi < arsi[1];
Bull.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Bear.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Bull.setdefaultColor(color.green);
Bear.setdefaultColor(color.red);
Bear.setlineWeight(1);
Bear.setlineWeight(1);
 
Thanks @rad14733, I like this! I tried to insert an arrow at the bar where the color flips, my code is below, but of course is places the arrows accross the entire stretch of color. What can I change in order to just have the arrow under the color flipped bar?

Code:
plot Bull = arsi > arsi[1];
plot Bear = arsi < arsi[1];
Bull.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Bear.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Bull.setdefaultColor(color.green);
Bear.setdefaultColor(color.red);
Bear.setlineWeight(1);
Bear.setlineWeight(1);

Try changing the following plots

Code:
plot Bull = (arsi[2] > arsi[1]) and arsi > arsi[1];
plot Bear = (arsi[2] < arsi[1]) and arsi < arsi[1];
 
@je®emy @SleepyZ You two must have been reading my mind because I've entertained adding the reversals several times recently... I have updated the code in Post #1 to include the optional reversal arrows and trend indicating ARSI value chart label.
 
@rad14733 I thought that MTF aggregations may be useful, and frankly I need the practice. This is mostly copy and paste on my part based on the MTF RSI by @horserider, with (I hope) the necessary adjustments. The code may not be as elegant as some, so feel free to polish it up if you see fit. Thank you very much for the education!

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ
# v1.3 : 2021-07-08 : Added MTF Aggregations - @je®emy

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.LIGHT_GREEN);
arsi.DefineColor("DownTrend", Color.LIGHT_RED);
arsi.SetLineWeight(1);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

AddLabel(showLabel, "ARSI: " + arsi, if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

plot bull = arsi[2] > arsi[1] and arsi > arsi[1];
bull.SetDefaultColor(Color.LIGHT_GREEN);
bull.SetlineWeight(1);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetHiding(!showReversals);

plot bear = arsi[2] < arsi[1] and arsi < arsi[1];
bear.SetDefaultColor(Color.LIGHT_RED);
bear.SetLineWeight(1);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetHiding(!showReversals);

#ARSI2
input length2 = 14;
input price2 = close;
input averageType2 = AverageType.WILDERS;
input agg = AggregationPeriod.DAY;
input showLabel2 = no;
input showReversals2 = no;

def c = close(period = agg);

def rsi2 = 2 * AbsValue(rsi(length, c, averageType) / 100 - 0.5);

def arsi2Data = rsi2 * c + (1 - rsi2) * (if isNaN(arsi2Data[1]) then 0 else arsi2Data[1]);

plot arsi2 = arsi2Data;
arsi2.DefineColor("UpTrend", Color.GREEN);
arsi2.DefineColor("DownTrend", Color.RED);
arsi2.SetLineWeight(3);
arsi2.SetPaintingStrategy(PaintingStrategy.LINE);
arsi2.SetStyle(Curve.FIRM);
arsi2.AssignValueColor(if arsi2 > arsi2[1] then arsi2.Color("UpTrend") else arsi2.Color("DownTrend"));

AddLabel(showLabel, "ARSI2: " + arsi2, if arsi2 > arsi2[1] then arsi2.Color("UpTrend") else arsi2.Color("DownTrend"));

plot bull2 = arsi2[2] > arsi2[1] and arsi2 > arsi2[1];
bull2.SetDefaultColor(Color.GREEN);
bull2.SetlineWeight(3);
bull2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull2.SetHiding(!showReversals);

plot bear2 = arsi2[2] < arsi2[1] and arsi2 < arsi2[1];
bear2.SetDefaultColor(Color.RED);
bear2.SetLineWeight(3);
bear2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear2.SetHiding(!showReversals);

#ARSI3
input length3 = 14;
input price3 = close;
input averageType3 = AverageType.WILDERS;
input agg3 = AggregationPeriod.DAY;
input showLabel3 = no;
input showReversals3 = no;

def c3 = close(period = agg3);

def rsi3 = 2 * AbsValue(rsi(length, c3, averageType) / 100 - 0.5);

def arsi3Data = rsi3 * c3 + (1 - rsi3) * (if isNaN(arsi3Data[1]) then 0 else arsi3Data[1]);

plot arsi3 = arsi3Data;
arsi3.DefineColor("UpTrend", Color.DARK_GREEN);
arsi3.DefineColor("DownTrend", Color.DARK_RED);
arsi3.SetLineWeight(5);
arsi3.SetPaintingStrategy(PaintingStrategy.LINE);
arsi3.SetStyle(Curve.FIRM);
arsi3.AssignValueColor(if arsi3 > arsi3[1] then arsi3.Color("UpTrend") else arsi3.Color("DownTrend"));

AddLabel(showLabel, "ARSI3: " + arsi3, if arsi3 > arsi3[1] then arsi3.Color("UpTrend") else arsi3.Color("DownTrend"));

plot bull3 = arsi3[2] > arsi3[1] and arsi3 > arsi3[1];
bull3.SetDefaultColor(Color.DARK_GREEN);
bull3.SetlineWeight(5);
bull3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull3.SetHiding(!showReversals);

plot bear3 = arsi3[2] < arsi3[1] and arsi3 < arsi3[1];
bear3.SetDefaultColor(Color.DARK_RED);
bear3.SetLineWeight(5);
bear3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear3.SetHiding(!showReversals);

# END - ARSI
 
@je®emy Can you post an image of what your chart looks like with your MTF modifications... On my chart is is simply three plotted lines, the same as one would get by loading the standard ARSI three times and editing the settings... Not a true MTF implementation...
 
Perhaps my understanding of MTF is incorrect. In this example I have lines for ARSI in D, Wk, and Mo timeframes. I did also notice that the toggles for Show Reversals and Show Labels does not work for aggs 2 and 3.

dzRHnfz.jpg
 
The ARSI is an upper indicator that works like a moving average but based on RSI... It works well for scalping which is what drew my original interest... While the standard RSI uses a length of 14 it is recommended to use a shorter length for this indicator and 3 is a good length for scalping on lower timeframes...

I will be adding more details as well as more images as time allows...

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.GREEN); #GREEN
arsi.DefineColor("DownTrend", Color.RED); #RED
arsi.SetLineWeight(3);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

AddLabel(showLabel, "ARSI: " + arsi, if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

plot bull = arsi[2] > arsi[1] and arsi > arsi[1];
bull.SetDefaultColor(Color.GREEN);
bull.SetlineWeight(1);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetHiding(!showReversals);

plot bear = arsi[2] < arsi[1] and arsi < arsi[1];
bear.SetDefaultColor(Color.RED);
bear.SetLineWeight(1);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetHiding(!showReversals);

# END - ARSI

CL1ciE4.png
can you please provide the lower study codes?
 
The ARSI is an upper indicator that works like a moving average but based on RSI... It works well for scalping which is what drew my original interest... While the standard RSI uses a length of 14 it is recommended to use a shorter length for this indicator and 3 is a good length for scalping on lower timeframes...

I will be adding more details as well as more images as time allows...

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.GREEN); #GREEN
arsi.DefineColor("DownTrend", Color.RED); #RED
arsi.SetLineWeight(3);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

AddLabel(showLabel, "ARSI: " + arsi, if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

plot bull = arsi[2] > arsi[1] and arsi > arsi[1];
bull.SetDefaultColor(Color.GREEN);
bull.SetlineWeight(1);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetHiding(!showReversals);

plot bear = arsi[2] < arsi[1] and arsi < arsi[1];
bear.SetDefaultColor(Color.RED);
bear.SetLineWeight(1);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetHiding(!showReversals);

# END - ARSI

CL1ciE4.png
When I looked at the charts with this indicator, it appeared to be a winning trading strategy. In my judgment, this does not appear to do repainting. Could you, however, please confirm? Thank you very much.
 
I add three different aggregation times of day, two-days and three-days.


Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ
input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.LIGHT_GREEN);
arsi.DefineColor("DownTrend", Color.LIGHT_RED);
arsi.SetLineWeight(3);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));


input agg1 = AggregationPeriod.TWO_DAYS;
input length1 = 14;
def price1 = close(period = agg1);
input averageType1 = AverageType.WILDERS;
def rsi1 = 2 * AbsValue(rsi(length1, price1, averageType) / 100 - 0.5);
def arsiData1 = rsi1 * price1 + (1 - rsi1) * (if isNaN(arsiData1[1]) then 0 else arsiData1[1]);
plot arsi1 = arsiData1;
arsi1.DefineColor("UpTrend", Color.LIGHT_GREEN);
arsi1.DefineColor("DownTrend", Color.LIGHT_RED);
arsi1 .SetLineWeight(3);
arsi1 .SetPaintingStrategy(PaintingStrategy.LINE);
arsi1 .SetStyle(Curve.FIRM);
arsi1 .AssignValueColor(if arsi1 > arsi1 [1] then arsi1 .Color("UpTrend") else arsi1 .Color("DownTrend"));

input agg2 = AggregationPeriod.THREE_DAYS;
input length2 = 14;
def price2 = close(period = agg2);
input averageType2 = AverageType.WILDERS;
def rsi2 = 2 * AbsValue(rsi(length2, price2, averageType) / 100 - 0.5);
def arsiData2 = rsi2 * price2 + (1 - rsi2) * (if isNaN(arsiData2[1]) then 0 else arsiData2[1]);
plot arsi2 = arsiData2;
arsi2.DefineColor("UpTrend", Color.LIGHT_GREEN);
arsi2.DefineColor("DownTrend", Color.LIGHT_RED);
arsi2 .SetLineWeight(3);
arsi2 .SetPaintingStrategy(PaintingStrategy.LINE);
arsi2 .SetStyle(Curve.FIRM);
arsi2 .AssignValueColor(if arsi2 > arsi2 [1] then arsi2 .Color("UpTrend") else arsi2 .Color("DownTrend"));
 
Last edited:
I add five different aggregation periods of day, two-days, three-days, four-days and week. You can use lower timeframes to see supports and resistances.

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
#https://usethinkscript.com/threads/arsi-adaptive-relative-strength-index-for-thinkorswim.6116/

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.GREEN);
arsi.DefineColor("DownTrend", Color.RED);
arsi.SetLineWeight(3);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));


input agg1 = AggregationPeriod.TWO_DAYS;
def price1 = close(period = agg1);
input averageType1 = AverageType.WILDERS;
def rsi1 = 2 * AbsValue(rsi(length, price1, averageType) / 100 - 0.5);
def arsiData1 = rsi1 * price1 + (1 - rsi1) * (if isNaN(arsiData1[1]) then 0 else arsiData1[1]);
plot arsi1 = arsiData1;
arsi1.DefineColor("UpTrend", Color.GREEN);
arsi1.DefineColor("DownTrend", Color.RED);
arsi1 .SetLineWeight(1);
arsi1 .SetPaintingStrategy(PaintingStrategy.LINE);
arsi1 .SetStyle(Curve.FIRM);
arsi1 .AssignValueColor(if arsi1 > arsi1 [1] then arsi1 .Color("UpTrend") else arsi1 .Color("DownTrend"));

input agg2 = AggregationPeriod.THREE_DAYS;
def price2 = close(period = agg2);
input averageType2 = AverageType.WILDERS;
def rsi2 = 2 * AbsValue(rsi(length, price2, averageType) / 100 - 0.5);
def arsiData2 = rsi2 * price2 + (1 - rsi2) * (if isNaN(arsiData2[1]) then 0 else arsiData2[1]);
plot arsi2 = arsiData2;
arsi2.DefineColor("UpTrend", Color.GREEN);
arsi2.DefineColor("DownTrend", Color.RED);
arsi2 .SetLineWeight(1);
arsi2 .SetPaintingStrategy(PaintingStrategy.LINE);
arsi2 .SetStyle(Curve.FIRM);
arsi2 .AssignValueColor(if arsi2 > arsi2 [1] then arsi2 .Color("UpTrend") else arsi2 .Color("DownTrend"));


input agg3 = AggregationPeriod.FOUR_DAYS;
input length3 = 14;
def price3= close(period = agg3);
input averageType3 = AverageType.WILDERS;
def rsi3 = 2 * AbsValue(rsi(length3, price3, averageType) / 100 - 0.5);
def arsiData3 = rsi3 * price3 + (1 - rsi3) * (if isNaN(arsiData3[1]) then 0 else arsiData3[1]);
plot arsi3 = arsiData3;
arsi3.DefineColor("UpTrend", Color.GREEN);
arsi3.DefineColor("DownTrend", Color.RED);
arsi3 .SetLineWeight(1);
arsi3 .SetPaintingStrategy(PaintingStrategy.LINE);
arsi3 .SetStyle(Curve.FIRM);
arsi3 .AssignValueColor(if arsi3 > arsi3 [1] then arsi3 .Color("UpTrend") else arsi3 .Color("DownTrend"));


input agg4 = AggregationPeriod.week;
def price4= close(period = agg4);
input averageType4 = AverageType.WILDERS;
def rsi4 = 2 * AbsValue(rsi(length, price4, averageType) / 100 - 0.5);
def arsiData4 = rsi3 * price4 + (1 - rsi4) * (if isNaN(arsiData4[1]) then 0 else arsiData4[1]);
plot arsi4 = arsiData4;
arsi4.DefineColor("UpTrend", Color.GREEN);
arsi4.DefineColor("DownTrend", Color.RED);
arsi4.SetLineWeight(1);
arsi4.SetPaintingStrategy(PaintingStrategy.LINE);
arsi4.SetStyle(Curve.FIRM);
arsi4 .AssignValueColor(if arsi4 > arsi4 [1] then arsi4.Color("UpTrend") else arsi4.Color("DownTrend"));
 
Last edited:
@rad14733 I thought that MTF aggregations may be useful, and frankly I need the practice. This is mostly copy and paste on my part based on the MTF RSI by @horserider, with (I hope) the necessary adjustments. The code may not be as elegant as some, so feel free to polish it up if you see fit. Thank you very much for the education!

Ruby:
# ARSI
#hint: Adaptive Relative Strength Index Indicator for Thinkscript
# Created by rad14733 for usethinkscript.com
# Based on Tradingview ARSI @ https://www.tradingview.com/script/tSpy2kw2-Adaptive-RSI/
# Plots a colored line on the upper chart based on trend direction.
# v1.0 : 2021-03-28 : Initial Release
# v1.1 : 2021-05-13 : Added trend indicating ARSI value chart label
# v1.2 : 2021-07-07 : Added reversal arrows - credit to @je®emy & @SleepyZ
# v1.3 : 2021-07-08 : Added MTF Aggregations - @je®emy

input length = 14;
input price = close;
input averageType = AverageType.WILDERS;
input showLabel = no;
input showReversals = no;

def rsi = 2 * AbsValue(rsi(length, price, averageType) / 100 - 0.5);

def arsiData = rsi * price + (1 - rsi) * (if isNaN(arsiData[1]) then 0 else arsiData[1]);

plot arsi = arsiData;
arsi.DefineColor("UpTrend", Color.LIGHT_GREEN);
arsi.DefineColor("DownTrend", Color.LIGHT_RED);
arsi.SetLineWeight(1);
arsi.SetPaintingStrategy(PaintingStrategy.LINE);
arsi.SetStyle(Curve.FIRM);
arsi.AssignValueColor(if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

AddLabel(showLabel, "ARSI: " + arsi, if arsi > arsi[1] then arsi.Color("UpTrend") else arsi.Color("DownTrend"));

plot bull = arsi[2] > arsi[1] and arsi > arsi[1];
bull.SetDefaultColor(Color.LIGHT_GREEN);
bull.SetlineWeight(1);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetHiding(!showReversals);

plot bear = arsi[2] < arsi[1] and arsi < arsi[1];
bear.SetDefaultColor(Color.LIGHT_RED);
bear.SetLineWeight(1);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetHiding(!showReversals);

#ARSI2
input length2 = 14;
input price2 = close;
input averageType2 = AverageType.WILDERS;
input agg = AggregationPeriod.DAY;
input showLabel2 = no;
input showReversals2 = no;

def c = close(period = agg);

def rsi2 = 2 * AbsValue(rsi(length, c, averageType) / 100 - 0.5);

def arsi2Data = rsi2 * c + (1 - rsi2) * (if isNaN(arsi2Data[1]) then 0 else arsi2Data[1]);

plot arsi2 = arsi2Data;
arsi2.DefineColor("UpTrend", Color.GREEN);
arsi2.DefineColor("DownTrend", Color.RED);
arsi2.SetLineWeight(3);
arsi2.SetPaintingStrategy(PaintingStrategy.LINE);
arsi2.SetStyle(Curve.FIRM);
arsi2.AssignValueColor(if arsi2 > arsi2[1] then arsi2.Color("UpTrend") else arsi2.Color("DownTrend"));

AddLabel(showLabel, "ARSI2: " + arsi2, if arsi2 > arsi2[1] then arsi2.Color("UpTrend") else arsi2.Color("DownTrend"));

plot bull2 = arsi2[2] > arsi2[1] and arsi2 > arsi2[1];
bull2.SetDefaultColor(Color.GREEN);
bull2.SetlineWeight(3);
bull2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull2.SetHiding(!showReversals);

plot bear2 = arsi2[2] < arsi2[1] and arsi2 < arsi2[1];
bear2.SetDefaultColor(Color.RED);
bear2.SetLineWeight(3);
bear2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear2.SetHiding(!showReversals);

#ARSI3
input length3 = 14;
input price3 = close;
input averageType3 = AverageType.WILDERS;
input agg3 = AggregationPeriod.DAY;
input showLabel3 = no;
input showReversals3 = no;

def c3 = close(period = agg3);

def rsi3 = 2 * AbsValue(rsi(length, c3, averageType) / 100 - 0.5);

def arsi3Data = rsi3 * c3 + (1 - rsi3) * (if isNaN(arsi3Data[1]) then 0 else arsi3Data[1]);

plot arsi3 = arsi3Data;
arsi3.DefineColor("UpTrend", Color.DARK_GREEN);
arsi3.DefineColor("DownTrend", Color.DARK_RED);
arsi3.SetLineWeight(5);
arsi3.SetPaintingStrategy(PaintingStrategy.LINE);
arsi3.SetStyle(Curve.FIRM);
arsi3.AssignValueColor(if arsi3 > arsi3[1] then arsi3.Color("UpTrend") else arsi3.Color("DownTrend"));

AddLabel(showLabel, "ARSI3: " + arsi3, if arsi3 > arsi3[1] then arsi3.Color("UpTrend") else arsi3.Color("DownTrend"));

plot bull3 = arsi3[2] > arsi3[1] and arsi3 > arsi3[1];
bull3.SetDefaultColor(Color.DARK_GREEN);
bull3.SetlineWeight(5);
bull3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull3.SetHiding(!showReversals);

plot bear3 = arsi3[2] < arsi3[1] and arsi3 < arsi3[1];
bear3.SetDefaultColor(Color.DARK_RED);
bear3.SetLineWeight(5);
bear3.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear3.SetHiding(!showReversals);

# END - ARSI
Both Arsi2 & Arsi3 are AggregationPeriod Day is that right OR it should be Day & Week
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
501 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top