OPEN-SOURCE SCRIPT

On Balance Volume with Cross

Updated
OBV indicator with a few key changes that can turn it into a filter or trading indicator as-is.

  • Volume calculation given a look-back to help clarify trends without smoothing lag
  • Change the source (HLC3 indicates a little faster in backtesting)
  • Smooth the signal if desired
  • Moving average (MA) added for crossover indication in trend change
  • MA can be either EMA or HMA**


** My personal use:
EMA for trend filtering trades: Trade long signals if OBV is above the MA, trade short signals if OBV is below the MA.
HMA for scalping and chop: Normally set the HMA to 20 or 15 and trade the crosses. Works on most time frames and generates a lot of noise. 5 min and 15 min seems best for me in day trading

Example of trend trading using only the OBV-C and no other indicators, stops, or trailing stops:
snapshot
This could obviously be improved using stops, trailing stops, or other indicators to filter when to enter & exit trades or mitigate loss.

Example of trading using the HMA and lower time frames with Elder's Force Index (EFI) used as a filter. Trade with both cross at or very near the same time. Winning trades in green:
snapshot
Release Notes
Modification to the standard OBV indicator that adds flexibility and cleaner trend data or more responsive trend changes.
  • Change OBV calculation from standard 1 day to custom range
  • Smooth the OBV line if desired (not suggested, adds lag)
  • Add a moving average cross to indicator
  • Change select moving average type to: SMA, EMA, WMA, or HMA
  • Background highlight for easier dashboard setup


Suggested pair with FauxLife EFI to use as a filter & entry/exit setup. Enter or exit trades when the two indicators switch at the same time or within 1-2 candlesticks of each other.
snapshot
crosscryptoForexTrend AnalysisVolume IndicatorVolume

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer