Trading Articles
Article Categories
Article Tools
moving average of RSI in ThinkOrSwim
Updated June 28, 2022
Top Posters
looks_one
jeffro
with 2 posts (4 thanks)
looks_two
kburks
with 2 posts (0 thanks)
looks_3
SinSanDiego
with 2 posts (0 thanks)
looks_4
Quick Summary
with 1 posts (0 thanks)
trending_up
11,094 views
thumb_up
5 thanks given
group
7 followers
forum
9 posts
attach_file
1 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
moving average of RSI in ThinkOrSwim
(login for full post details)
#1 (permalink )
Boynton Beach
Experience: Intermediate
Platform: NinjaTrader
Trading: ES,TF,CL
Posts: 203 since Mar 2012
Thanks: 327 given,
146
received
how to create a moving average of RSI in ThinkOrSwim PLEASE
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
San Diego, CA/United States
Experience: Intermediate
Platform: TOS
Trading: ES, CL, 6A
Posts: 17 since Apr 2015
Thanks: 2 given,
11
received
Here you go:
declare lower;
input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input RSI_smoothing_averageType = AverageType.exponential;
input RSI_smoothing_length = 10;
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;
def RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot RSI_moving_average = MovingAverage(RSI_smoothing_averageType, RSI, RSI_smoothing_length);
RSI_moving_average.DefineColor("OverBought", GetColor(5));
RSI_moving_average.DefineColor("Normal", GetColor(7));
RSI_moving_average.DefineColor("OverSold", GetColor(1));
RSI_moving_average.AssignValueColor(if RSI > over_Bought then RSI_moving_average.color("OverBought") else if RSI < over_Sold then RSI_moving_average.color("OverSold") else RSI_moving_average.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
The following 2 users say Thank You to jeffro for this post:
(login for full post details)
#4 (permalink )
Boynton Beach
Experience: Intermediate
Platform: NinjaTrader
Trading: ES,TF,CL
Posts: 203 since Mar 2012
Thanks: 327 given,
146
received
Thanks so much, how to I get the code from here to the platform?
(login for full post details)
#5 (permalink )
San Diego, CA/United States
Experience: Intermediate
Platform: TOS
Trading: ES, CL, 6A
Posts: 17 since Apr 2015
Thanks: 2 given,
11
received
No worries.
Highlight and copy all the code I supplied. Open ThinkorSwim and go to charts, then click studies-->edit studies. A window will pop up and select "new" in the bottom left corner. A new script window will pop up. Clear out the window of any text code in there and paste the code you copied. You can change the name at the top of the window if you like. Hit "ok" and the indicator is now available.
Keep me posted on how it works for you. If you need any others let me know. I may be able to code it or already may have it coded.
-Jeff
The following 2 users say Thank You to jeffro for this post:
(login for full post details)
#6 (permalink )
Del Mar, CA
Posts: 4 since Mar 2021
Thanks: 2 given,
0
received
Not sure if this is the most appropriate place to ask this question, but stumbled on this thread and am hoping someone can help me create a ThinkorSwim script which will chart RSI with 2 (two) moving averages, rather than just one--a 9 period SMA (shown in green) and 45 period WMA (shown in red), atop the raw RSI (in black). Am happy to pay someone to help me with this if necessary. Many thanks.
(login for full post details)
#7 (permalink )
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks: 9 given,
43
received
Let me know if this is what you wanted. I used the TOS RSI code as a starting point and added the averages at the bottom.
Code
declare lower;
input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
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);
input average1Type = AverageType.SIMPLE;
input average1Length = 9;
input average2Type = AverageType.WILDERS;
input average2Length = 45;
plot avg1 = MovingAverage(average1Type, RSI, average1Length);
avg1.setDefaultColor(Color.GREEN);
plot avg2 = MovingAverage(average2Type, RSI, average2Length);
avg2.setDefaultColor(Color.RED);
The following user says Thank You to JayC for this post:
(login for full post details)
#8 (permalink )
Del Mar, CA
Posts: 4 since Mar 2021
Thanks: 2 given,
0
received
Thank you, JayC. Your code works nicely. Wishing you good fortune with your trading.
(login for full post details)
#9 (permalink )
Chicago, IL
Posts: 12 since Jan 2020
Thanks: 0 given,
7
received
Sometimes I like to overlay a 5 SMA on top of the RSI. The crosses often present some interesting opportunities.
(login for full post details)
#10 (permalink )
San Francisco CA USA
Posts: 5 since Sep 2015
Thanks: 2 given,
0
received
Why can't I simply drag and drop the moving average on top of the RSI like it's done on other platform? Why do I even need to code for such a simple task?
Last Updated on June 28, 2022
Ongoing