RSI with On Balance Volume OBV For ThinkorSwim?

diazlaz

Well-known member
2019 Donor
VIP
@jon this looked interesting, not sure if it was the same scripts/code in this thread, but I quickly ported it. I added a 50 line to it, and quick observations on lower time frames, you can trade this with high probably, crossing from OB or OS to the 50 line, quick intraday trading.

Ruby:
#On Balance Volume RSI (OBV RSI) by @robswc
#An RSI, using OBV as the source, use to find divergence in the OBV to indicate reversals.
#Tutorial on youtube: https://youtu.be/klC8U2XLovs
#
# 2019.11.24 1.0 @diazlaz - Original Port
#

declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input src = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

#net volume of positive and negative volume
def obv = if (src - src[1]) > 0 then volume else
if (src - src[1]) < 0 then -volume else 0 * volume;
def cnv = TotalSum(obv); #cumulative net volume
def price = cnv;

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;

plot mid = 50;
mid.SetPaintingStrategy(paintingStrategy = PaintingStrategy.DASHES);
mid.AssignValueColor(COLOR.DARK_GRAY);

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

AddCloud(over_Bought, Over_Sold, Color.Light_Gray, Color.Light_Gray);

#END OF OBV RSI
 
Last edited:

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

Quick scalp system to the 50

z9zy7DZ.png


If anyone improves it, test it or add more criteria please reply.
 

Attachments

  • z9zy7DZ.png
    z9zy7DZ.png
    87.2 KB · Views: 133
Quick scalp system to the 50

z9zy7DZ.png


If anyone improves it, test it or add more criteria please reply.

@diazlaz To make the OB/OS visually apparent, you might like to consider adding the following one liner to the end

AddCloud(over_Bought, Over_Sold, Color.Light_Gray, Color.Light_Gray);
 

Attachments

  • z9zy7DZ.png
    z9zy7DZ.png
    87.2 KB · Views: 100
Hi Guys,

Does anyone know if there is On Balance Volume (OBV) combined together with the RSI indicator for TOS?

Thank You
 
Is there a way to have a divergence line plotted automatically on the OBV with RSI? If anyone can code it would be a life saver.
 
stage three sell no Red arrows on the chart for Globex or cash on futures or stocks, the above code in post #24 must-have errors
 
updated the script to include the AddCloud. thanks tomsk.
Is it possible to add another cloud so I can have the option to determine the upper and lower area separate basically two separate shaded areas one at the top and one at the bottom?
 
Thank you for sharing this code. Can someone help me made a few tweaks to this code?

Instead of plotting the RSI using Average.Wilders, I need to plot the following:

First I want to get sum of ticks gained for the periods that price went up for let us say 14 days (which can be stored in UpPoints)
Second, I want to get sum of ticks lost for the periods that price went down for the same 14 days (which can be stored in DownPoints)
Third I want to get the ratio of UpPoints/DownPoints.

I was looking for code snippets that can get me that sum. I am new to thinkscript.

Appreciate it.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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