moving average of RSI in ThinkOrSwim - futures io
futures io



moving average of RSI in ThinkOrSwim


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one jeffro with 2 posts (4 thanks)
    2. looks_two kburks with 2 posts (0 thanks)
    3. looks_3 SinSanDiego with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 11,094 views
    2. thumb_up 5 thanks given
    3. group 7 followers
    1. forum 9 posts
    2. 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)

 
Search this Thread
 

moving average of RSI in ThinkOrSwim

(login for full post details)
  #1 (permalink)
 kburks 
Boynton Beach
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES,TF,CL
 
kburks's Avatar
 
Posts: 203 since Mar 2012
Thanks: 327 given, 146 received

how to create a moving average of RSI in ThinkOrSwim PLEASE

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
TradeStation Order Execution Networks stop server
TradeStation
Can multi charts execute code on any MT4/5 based broker …
MultiCharts
Daily systems newbie problems
MultiCharts
Beta tester for new NT8 indicator
NinjaTrader
Humans Orange County- Support Team - Future Fund Partners
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Anyone interested in me trying the get funded scams?
22 thanks
Considering leaving Ninjatrader behind. Alternatives for …
11 thanks
question to the DAX pro traders
9 thanks
Trading futures over 5G network
7 thanks
Slippage for MCL Futures
5 thanks
 
(login for full post details)
  #3 (permalink)
 jeffro 
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));

Reply With Quote
The following 2 users say Thank You to jeffro for this post:
 
(login for full post details)
  #4 (permalink)
 kburks 
Boynton Beach
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES,TF,CL
 
kburks's Avatar
 
Posts: 203 since Mar 2012
Thanks: 327 given, 146 received

Thanks so much, how to I get the code from here to the platform?

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
 jeffro 
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

Reply With Quote
The following 2 users say Thank You to jeffro for this post:
 
(login for full post details)
  #6 (permalink)
SinSanDiego
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.

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 JayC 
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);

Reply With Quote
The following user says Thank You to JayC for this post:
 
(login for full post details)
  #8 (permalink)
SinSanDiego
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.

Reply With Quote
 
(login for full post details)
  #9 (permalink)
AstroTuna
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.

Reply With Quote
 
(login for full post details)
  #10 (permalink)
peachfuzz
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?

Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > moving average of RSI in ThinkOrSwim


Last Updated on June 28, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts