RSI-VWAP Indicator for ThinkorSwim

this is what best I came up with existing study. 4 hours s&p futures.


Thank you @astro_phx

I was just messing up with rsivwap to accommodate your comment "if you take off RS ave and just make length2 settings to 3 then it automatically giving good crossover with smooth (21) if is giving really good entry points. Along with this if you could add lenth3 = 8 that will give another great trending indicator my point of view."

would you mind adding the following 3 lines at the end of rsivwap study and let me know, if this is what you are looking for. Appreciate your feedback

input length3 = 8;
plot average3 = average(rsi,Length3);
average3.Setlineweight(3);
 
Thank you @astro_phx

I was just messing up with rsivwap to accommodate your comment "if you take off RS ave and just make length2 settings to 3 then it automatically giving good crossover with smooth (21) if is giving really good entry points. Along with this if you could add lenth3 = 8 that will give another great trending indicator my point of view."

would you mind adding the following 3 lines at the end of rsivwap study and let me know, if this is what you are looking for. Appreciate your feedback

input length3 = 8;
plot average3 = average(rsi,Length3);
average3.Setlineweight(3);
That's what I am waiting for too. I will add it and check if that works.
 
Thank you @astro_phx

I was just messing up with rsivwap to accommodate your comment "if you take off RS ave and just make length2 settings to 3 then it automatically giving good crossover with smooth (21) if is giving really good entry points. Along with this if you could add lenth3 = 8 that will give another great trending indicator my point of view."

would you mind adding the following 3 lines at the end of rsivwap study and let me know, if this is what you are looking for. Appreciate your feedback

input length3 = 8;
plot average3 = average(rsi,Length3);
average3.Setlineweight(3);
It worked! thank you very much.
 
thank you @germanburrito it is working now. here how I use it. I use vwap on an upper study with slim ribbon and ichimoku kijun for profit booking or stop loss on the lower studies I use macd_BB and the study discussed here rsivwap (length 13 and smooth 21 and now length2=8)
1. entry short when price below vwap and rsivwap in red cloud take profit when macd_BB turn green.
2. entry long when price above vwap and rsivwap in green cloud take profit when macd_BB turns red.

i hope i explained it right. I am attaching image to show how it look.

Can you share your chart? Thank you.
 
I am new to this site...This sites has lot of stuff. Thanks a lot.

I am fairly a new trader with 1 yr experience....


1. I am looking for a script/config to alert me when the price touches VWAP and RSI touches 30 simultaneously on 5mins, 15 mins or 1min
2. similar alert script - when price touches VWAP only

Thanks in advance.
 
Thank you @germanburrito you guys with great script helped me so much. I just tried different settings and checked which one works best for trading. I hope you come up with more great new scripts and I will play with them.

https://twitter.com/astro_vadic

It would be great if you share your knowledge. Thank you very much for your kindness.

I tried it on 4 hours on stock and yes it really works great. There are a few other observations I just found out which I am sharing with you.
1. If you just keep kijun(setting 34) with just main vwap on 4 hours and check the crossover on it then you will find real good trending in any stock. this give really good trade on long of short both sides. I checked about 25 different large-cap stocks and all of them work great.
2. If you change some settings in rsivwap then it will work more efficiently in my view if you can edit this script by following settings I feel it will give better results.
if you take off RS ave and just make length2 settings to 3 then it automatically giving good crossover with smooth (21) if is giving really good entry points. Along with this if you could add lenth3 = 8 that will give another great trending indicator my point of view.

so along with just macd_BB rsivwapavg and vwap/kijun crossover this system will give great profits. in future if you could build up scanner of vwap/kijun scanner for 4 hours then it will give amazing results.

vwap/kijun crossover can be a great strategy too and I think it will give good backtesting results.

If there is any good scrip editor there who would like to help or if you get time to edit these It will be really great help for everyone.

I hope I am not asking too much since I don't know how to write scripts but I like playing with new settings and observed it on different stocks.

Thank you very much.
Hey @astro_phx nice strategy! Looks promising! Quick question. On 1. after Kijun setting. Main VWAP is just the regular VWAP? or is it a modified VWAP? Thanks!
 
Hi @astro_phx I just saw your strategy yesterday and I see the potential in it for my style of trading. I've been going back and forth on all of the posts to find out your settings. I've already added the 3rd length into the rsi vwap indicator and added that along with all the other indicators you mentioned into my chart. But I'm struggling on what settings you used for all of them. Can you please tell me what all of the settings you are currently using or share a link to your chart please? Thanks!
 
Hi @astro_phx I just saw your strategy yesterday and I see the potential in it for my style of trading. I've been going back and forth on all of the posts to find out your settings. I've already added the 3rd length into the rsi vwap indicator and added that along with all the other indicators you mentioned into my chart. But I'm struggling on what settings you used for all of them. Can you please tell me what all of the settings you are currently using or share a link to your chart please? Thanks!
I am using length 13, smooth 21, length2 5, and length3 55. if everything above length3 then it's bullish and if all below it then it's bearish if length 2 above level 50 it showing the trend is getting stronger and the below trend is weak. All other settings are same as given before.
 
Last edited:
I am using length 13, smooth 21, length2 5, and length3 55. if everything above length3 then it's bullish and if all below it then it's bearish if length 2 above level 50 it showing the trend is getting stronger and the below trend is weak. All other settings are same as given before.
Thank you @astro_phx. I just noticed that my lengh3 is not plotting and don't know if there are any other issues. Tried to see what I did wrong but unable to. I'm a nube in writing codes. So, can you please share your code or a link so I can compare? I would appreciate it. I would also like to follow you on Twitter so I can gain much knowledge from you. Thanks again.
 
Thank you @astro_phx. I just noticed that my lengh3 is not plotting and don't know if there are any other issues. Tried to see what I did wrong but unable to. I'm a nube in writing codes. So, can you please share your code or a link so I can compare? I would appreciate it. I would also like to follow you on Twitter so I can gain much knowledge from you. Thanks again.
Add this code at the bottom of the study script

input length3 = 55;
plot average3 = average(rsi,Length3);
average3.Setlineweight(3);
 
My overall goal is to create a custom column in my watchlist where the background changes color as certain conditions are met, and not even sure how to organize it. Ideally, one column would be preferred, but I think I might have to create 2 columns.

price over VWAP for last 5 bars = Green
price at VWAP within last 5 bars = Cyan
price below VWAP for last 5 bars = Red

RSI crossing above 60 within last 5 bars = Green
RSI crossing below 60 within last 5 bars = Orange
RSI crossing below 40 within last 5 bars = Red
RSI crossing above 40 within last 5 bars = Cyan

I tired creating Custom Scans, but I can't get them on a watchlist. So, I thought maybe I would have to create a custom study to add it as a column on the watchlist, but that doesn't seem to work either.

Now, I am in Custom Quote Formula in the ThinkScript Editor trying to just do a column for VWAP, but I'm having no luck. I've tried learning off a bunch of other custom scripts, but ToS is highlighting the last two sections in red. I would also be willing to just have the RSI value as a column the changes color depending on where the price is relative to VWAP if anyone could help with that.

Here is the current code I'm trying. I only added the "label" section because I thought I might need that for the editor to allow me to assign background color. Again, I'm totally willing to change my plan and use an RSI value as the label and change the background color if that's better.

Code:
# Green background means price is above vwap
# Blue background means price is at vwap within lastg 5 bars
# Red background means price is below vwap

plot price = close;

def shared_vwap_1;
def price = close;

addLabel(yes, if price>shared_vwap_1 then "+1" else if price=shared_vwap_1 within last 5 bars then "0" else if price<shared_vwap_1 then "-1" else "");

AssignBackgroundColor(if price>shared_vwap_1 then color.GREEN  else if price<shared_vwap_1 then color.RED else if price=shared_vwap_1 within last 5 bars then color.CYAN);

Help is greatly appreciated! I've been working on this for at least a collective 8 hours. It can be so frustrating.

Sincerely,

Heather B.
 
@hmbart Welcome to the usethinkscript forums... I'm sure your scan is doable but we need to define a few items better first... First, confirmations are based on conditional criteria, not colors... Therefore we need to determine which conditional criteria are met... Colors can be different on different members charts but the criteria remains the same... We need to establish proper semantics before we can create proper syntax... By that I mean that we need to know logic causes the condition that causes a color to be displayed, not the color itself... Clear as mud yet...???

Now. all that being said there are a few issues with your code as I will go through...

First, when we are working with conditional code we are talking numbers, not text... Therefore, all results are numbers... That means your "+1" and "-1" and "0" should not have quotes and the "+1" should simply be a 1, etc... That's the first part...

Next there is the issue of def shared_vwap_1;... You will receive an error in the subsequent code because shared_vwap_1 hasn't been assigned a value... Until it has been properly defined it cannot be used for anything else... Which brings me to the optimization aspect of writing code... Virtually all scripting languages will perform faster and more efficiently if we fully define variables before calculations rather than using function calls within complex calculation structures... This is very important in Thinkscript because it can greatly improve performance and mitigate potential lag...

So, without giving up the answer I'll leave it up to you to determine what the value of shared_vwap_1 should be and then you can optimize the code to work from there... Trust me, you're close - I think... You have some concepts to work from now at the very least... If you have additional questions just ask...
 
In honor of GME going to 300 I'm sharing a script that uses the RSI instead of price for the VWAP. I use it on the today 5 minute graph if anyone knows how to set it up daily, weekly or monthly it would be great.

Mdr7RZp.png


Code:
declare lower;

input length = 14;
input price = close;
input averageType = AverageType.simple;
input ratio = 2.236;
DefineGlobalColor("RisingMA", color.uptick);
DefineGlobalColor("FallingMA", color.downtick);

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);


def o = (RSI + RSI[1]) / 2;

def h = Max(RSI, RSI[1]);

def l = Min(RSI, RSI[1]);

def c = RSI;

def hl2 = (h+l)/2;
AddChart(high = h, low = l, open = o, close = c, type = ChartType.CANDLE, Color.WHITE);
input charttype = ChartType.CANDLE;


def Data = BarNumber();
input Number_Of_Bar = 1;

def bar =  Data >= Number_Of_Bar;
def pv = if bar then pv[1] + hl2 * volume else 0;
def cumvolume = if bar then cumvolume[1] + volume else 0;
plot vw = pv / cumvolume;
def bars = Data - Number_Of_Bar;
def sample = if bar then sample[1] + Sqr(hl2 - vw) else 0;
def var = sample / bars;
def dev = Sqrt(var);

plot dev1 =  vw + (dev * ratio);
plot dev2 = vw - (dev * ratio);

vw.setdefaultColor(color.yellow);
dev1.SetDefaultColor(Color.White);
dev2.SetDefaultColor(Color.White);


dev1.Setlineweight(2);
dev2.Setlineweight(2);


vw.SetLineWeight(3);
#vw.AssignValueColor(if rsi > vw
                           #then color.light_GREEN
                           #else color.light_RED);
I want to find out if you can change the candle colors to represent when the candles are going up it should show Green and when it's coming down it should give us a red candle on the indicator, can you do that?
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
330 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