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.

Release Notes: Minor fix : Change OBV plot color from white to yellow to fix white theme problem
Skript med en öppen källkod

I sann TradingView-anda har författaren till detta skript publicerat det som öppen källkod, så att handlare kan förstå och verifiera det. Skål för författaren! Du kan använda den gratis men återanvändning av den här koden i en publikation regleras av våra Ordningsregler. Du kan göra den till favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?


Thank you for your selfless sharing!
+1 Svara
MA_PT Yangxin28
@Yangxin28, Thank you for your comment and support

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 Svara
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?