OPEN-SOURCE SCRIPT
OBV+

OBV+
OBV+ tracks On Balance Volume against a moving average of itself and turns
that relationship into a directional state, then gates entries behind a
statistical trend test and manages the trade with a chandelier stop that only
ever moves in your favor.
HOW THE STATE WORKS
The indicator plots OBV with a configurable moving average (EMA, SMA, WMA,
RMA, or HMA). The distance between the two is ranked as a percentile against
its own recent history, so a strong OBV move is defined relative to what this
symbol has actually been doing rather than by a fixed number that means
something different on every chart. When that strength clears your threshold,
the state turns bullish or bearish and stays there until a qualifying move
flips it the other way. A minimum bar spacing keeps the state from
oscillating.
HOW ENTRIES WORK
A state flip on its own does not open a trade. The flip arms an entry window,
and within that window a linear regression on price must independently confirm
that a trend exists in the same direction, measured by the t statistic of the
regression slope. If the trend test agrees, the trade opens. If the window
closes without confirmation, the flip expires and prints a small gray circle
so you can see exactly which signals were passed over. The next entry then
waits for a fresh flip.
Price bars are colored by the gate rather than by raw OBV, so bars show green
or red only where both conditions are satisfied and gray everywhere else. You
can see at a glance which parts of the chart the indicator considers
tradeable.
HOW EXITS WORK
The stop arms immediately on the entry bar, placed beyond that bar's range so
a wide entry candle cannot take you out on the next bar. From there it trails
from the highest high reached since entry (or lowest low when short) at a
configurable ATR multiple, and it is hard clamped so it can only tighten. In a
long it never moves down. It tightens as volatility contracts and holds its
ground when volatility expands. The stop line is drawn directly on price
alongside entry triangles and exit crosses.
The trailing stop is the only exit by default. Opposite states are ignored
while a position is open, so a brief counter signal that does not reach your
stop leaves the trade running. If you would rather have state changes close
and reverse the position, there is a switch for it.
INPUTS
MA type and length, strength lookback and minimum percentile, minimum bars
between flips, regression lookback, minimum absolute t statistic, confirmation
window length, ATR length and chandelier multiple, plus a flip reverses
position toggle. Display options cover the fill, the trail, trade markers, and
bar coloring, with configurable bull, bear, and neutral colors. An optional
pane mode swaps OBV for the signed strength percentile with the threshold
lines drawn, which makes it easy to see which moves clear the bar.
ALERTS
Separate alert conditions for long entry, short entry, and exit, plus a single
combined alert carrying the ticker, timeframe, strength percentile, t
statistic, and current stop level.
NOTES
Because the signal is built from volume, results depend on the volume series
your data feed provides, and the same symbol can behave differently across
exchanges. Signals evaluate on bar close. Settings are deliberately open
ended: a low strength percentile with a short regression lookback produces
frequent, permissive signals, while raising the percentile and the t threshold
narrows it toward fewer and more selective ones. This is for informational purposes
only and isn't meant as financial advice.
OBV+ tracks On Balance Volume against a moving average of itself and turns
that relationship into a directional state, then gates entries behind a
statistical trend test and manages the trade with a chandelier stop that only
ever moves in your favor.
HOW THE STATE WORKS
The indicator plots OBV with a configurable moving average (EMA, SMA, WMA,
RMA, or HMA). The distance between the two is ranked as a percentile against
its own recent history, so a strong OBV move is defined relative to what this
symbol has actually been doing rather than by a fixed number that means
something different on every chart. When that strength clears your threshold,
the state turns bullish or bearish and stays there until a qualifying move
flips it the other way. A minimum bar spacing keeps the state from
oscillating.
HOW ENTRIES WORK
A state flip on its own does not open a trade. The flip arms an entry window,
and within that window a linear regression on price must independently confirm
that a trend exists in the same direction, measured by the t statistic of the
regression slope. If the trend test agrees, the trade opens. If the window
closes without confirmation, the flip expires and prints a small gray circle
so you can see exactly which signals were passed over. The next entry then
waits for a fresh flip.
Price bars are colored by the gate rather than by raw OBV, so bars show green
or red only where both conditions are satisfied and gray everywhere else. You
can see at a glance which parts of the chart the indicator considers
tradeable.
HOW EXITS WORK
The stop arms immediately on the entry bar, placed beyond that bar's range so
a wide entry candle cannot take you out on the next bar. From there it trails
from the highest high reached since entry (or lowest low when short) at a
configurable ATR multiple, and it is hard clamped so it can only tighten. In a
long it never moves down. It tightens as volatility contracts and holds its
ground when volatility expands. The stop line is drawn directly on price
alongside entry triangles and exit crosses.
The trailing stop is the only exit by default. Opposite states are ignored
while a position is open, so a brief counter signal that does not reach your
stop leaves the trade running. If you would rather have state changes close
and reverse the position, there is a switch for it.
INPUTS
MA type and length, strength lookback and minimum percentile, minimum bars
between flips, regression lookback, minimum absolute t statistic, confirmation
window length, ATR length and chandelier multiple, plus a flip reverses
position toggle. Display options cover the fill, the trail, trade markers, and
bar coloring, with configurable bull, bear, and neutral colors. An optional
pane mode swaps OBV for the signed strength percentile with the threshold
lines drawn, which makes it easy to see which moves clear the bar.
ALERTS
Separate alert conditions for long entry, short entry, and exit, plus a single
combined alert carrying the ticker, timeframe, strength percentile, t
statistic, and current stop level.
NOTES
Because the signal is built from volume, results depend on the volume series
your data feed provides, and the same symbol can behave differently across
exchanges. Signals evaluate on bar close. Settings are deliberately open
ended: a low strength percentile with a short regression lookback produces
frequent, permissive signals, while raising the percentile and the t threshold
narrows it toward fewer and more selective ones. This is for informational purposes
only and isn't meant as financial advice.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Don't force a trade. Wait for your setup, be patient. Trade ideas are my own and not financial advice, I'm a monkey with a phone for crying out loud.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Don't force a trade. Wait for your setup, be patient. Trade ideas are my own and not financial advice, I'm a monkey with a phone for crying out loud.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.