OBV High / LOW (On-Balance Volume )

This is a simple application of OBV indicator (On-Balance Volume ), to visually determine when a given stock current obv is near the highest or lowest based on the number of lookback bars.

Indicator examples:

### OBV value is near an all-time high ##
  • breakthrough, stock value could set new all-time highs.
  • rejection, stock value could come down or consolidate.



  • OBV High Lookback -> numbers of bars to look back for the obv high.
  • OBV LowLookback -> numbers of bars to look back for the obv low.
  • OBV EMA Length -> Ema length

  • This script also comes with an ema indicator based on obv for smoothing the obv signal since it gets noise at lower timeframes (by default comes disabled)

OBV information

This is my first script any ideas, suggestions, or detected errors (language/script) don´t hesitate to send a message.

Best regards, Mauro.

הערות שחרור: Minor fix : Change OBV plot color from white to yellow to fix white theme problem
סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר סקריפט זה פרסם אותו עם קוד פתוח, כך שסוחרים יוכלו להבין ולאמת זאת. הידד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום הנו בכפוף ל כללי הבית . אתה יכול להגדירו כמועדף ולהשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?



One needs to know what they're looking for with this script. For me, this script can do what scripts with 100s of lines of code couldn't.

Thank you - God bless you, brother!
+1 השב
MA_PT kpiyush114
@kpiyush114, Thank you for the feedback, I will start adding "how to use" moving forward for better understanding.
Regarding the lines of code, sometimes is all about finding the right tool instead of reinventing the "wheel". :D

Can't agree more!
This is awesome is exactly what I'm looking for! One thing I noticed though - when I add the indicator, It's added into a different pane than the OBV standard indicator is, and all that is shown is the upper blue and lower red line. So I'm not able to see the actual OBV line in the same pane - am I doing something wrong?
MA_PT Rumster30
@Rumster30, If I'm understanding your question correctly. The script comes with the "built-in" OBV (by default is the white line ), therefore you don't need to add the built-in obv to the new pane.
Hopes this helps with your question.

Note: Tradingview only allows currently the option "overlay" (false/true ) meaning it either creates a new pane or overlays the stock pane, but you can still move scripts around by dragging scripts in the object tree tab.
@MA_PT, This worked out perfectly actually - just changed the color of OBV to black (duh) - it was white so I couldn't see it - thanks for your time and help! DOn't want to be a pest - is it possible to make another one that draws a line based on the previous all-time high/low? Just to see how the current obv is breaking through the all time-high? How did you learn how to do this? This is fantastic work!
MA_PT Rumster30
@Rumster30, I usually use a dark theme didn't realize that wouldn't work plotting a white line on a white theme (my bad).
Regarding the second question, not sure if I'm understanding correctly but you're looking to plot lines on all-time (high/low) in the price (bar chart) or the obv chart?
@MA_PT, thanks so much for the quick reply. So it would be an all time high/low on the obv. So those blue and red lines that are created by prior highs (with a back-looking time limit -e.g - 50 bars or 100 bars). Instead there would be no time limit. Does that make sense?
@MA_PT, ANother great thing would be to have historical lines of support/resistance plotted on the OBV. If the price hits an all-time high and the OBV hits a historical point of resistance/support, that's a sign of a reversal is coming. Having both of those things on the same indicator would be KILLER! Wish I knew how to do this like you!! Fantastic work!!
MA_PT Rumster30
@Rumster30, That's quite an interesting idea, was not considering at the beginning look so far bar, but looking at some charts indeed there seems to be some pullback on historical all-time high (>1 year).
One example that I looked, was AAPL (Daily), it hit a price high and pulled back (around September 2020) when It hit a historical OBV high as far back as March 2015.
I´m thinking about upgrading this script to account for Historical highs and the Number of "touches" followed by a pullback.
+1 השב