NEWCard payments are live · from $18/month, USDT also acceptedSee plans
COINPRED / STRATEGY LIBRARY

BTC OBVious MA: Go long when on-balance volume crosses above its entry average, then exit when it crosses below the exit average

An open-source trend strategy by ThousandX_Trader (MPL 2.0). By default it is long only: it buys when OBV crosses above the entry moving average (190 by default) and no long is open, then exits when OBV crosses below the exit average (202 by default). Switch Direction to short to use a slower pair of averages for shorts instead. The author's chart is COINBASE:BTCUSD on the 4-hour timeframe. The rules follow the source; this page has no invented backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
ThousandX_Trader · 1.0 · 2026-11-29 · Trend following
BTC OBVious MA: Go long when on-balance volume crosses above its entry average, then exit when it crosses below the exit average

What the strategy is trying to do

This is an open-source script by ThousandX_Trader. The script title is “OBVious MA Strategy [1000X]”. It does not use a price moving average. It builds an on-balance volume (OBV) line, then pairs that line with a separate entry average and exit average. By default it only goes long: it enters when OBV crosses up through the entry average and exits when OBV crosses back down through the exit average. Shorts use a slower pair of averages, and they only arm if you set Direction to short.

The author's chart is COINBASE:BTCUSD on the 4-hour timeframe, so this page files the script under BTC. The source does not hard-code a symbol; it will load on other charts, but the write-up and the image follow that publication chart. overlay is set to false, so the OBV and its averages plot in a separate pane; the price chart mainly shows the trade marks. The default size is 100% of equity, commission is 0.1%, slippage is 1 tick, and initial capital is 10,000. The 1000X in the title and the margin arguments are easy to misread as 1,000× leverage; the order size is still 100% of equity, and the caveat is spelled out below.

Author chart of the OBV moving-average strategy on COINBASE:BTCUSD, 4-hour timeframe, showing price, the OBV pane with averages, and trade marks
Author chart: COINBASE:BTCUSD (Bitcoin), 4-hour timeframe, from the author's publication page. Price, the on-balance volume line with its averages, and entry/exit marks are visible; this only shows the layout and is not evidence of performance.

How the indicators are calculated

  • OBV adds the bar's volume when the close does not fall (including an unchanged close) and subtracts it when the close falls. Some textbook versions add nothing on an unchanged close; this one still adds volume on those bars.
  • The long entry average is an SMA of that OBV line, 190 bars by default. The long exit average defaults to 202, a little slower. The short entry average defaults to 395, and the short exit average defaults to 300, which is shorter than the short entry length.
  • Entries look for a cross (crossover or crossunder), not for OBV already sitting above the average. If OBV is already above the entry average when you add the script, the first long waits until it drops back and crosses up again.
  • All four averages are calculated, but the pane only plots the pair that matches the current Direction, so the other side does not clutter the chart.
  • There is no date window and no separate stop or target price.

Entry rules

  • Long (order name Long Entry): Direction is not short (it defaults to long), position size is less than or equal to 0, and OBV crosses above the long entry average (190 by default).
  • A short (order name Short Entry) does not fire by default. It only opens if you set Direction to short, position size is greater than or equal to 0, and OBV crosses below the short entry average (395 by default).
  • Direction has only two options, long and short, so the script will not run both sides at once. To flip the allowed side you change that input; the script does not flip it for you.
  • It does not add to a position already in the same direction. If you have switched to short and a short entry fires while a long is still open, the source closes “Long Entry” first and then opens “Short Entry”; the opposite path is the same.
  • The source does not wait for barstate.isconfirmed. On a 4-hour chart, the still-forming close and volume can move, so an OBV cross can appear and disappear before the bar ends; whether a fill stands depends on your TradingView order settings.

Exits and position size

  • A long exits when OBV crosses below the long exit average (202 by default). That test does not look at Direction; if the cross happens, it closes the order named “Long Entry”.
  • A short exits when OBV crosses above the short exit average (300 by default), and that close only applies to “Short Entry”.
  • There is no strategy.exit and no fixed stop or take-profit order. Exits come only from those crosses.
  • Each entry is 100% of equity. Pyramiding is left at the Pine default of 1. The notional changes with the symbol and account equity, so treat the size as your own risk setting.
  • The strategy() call sets margin_long and margin_short to 0.1. In Pine those values are a percentage of position value, so 0.1 means 0.1% and the tester's margin floor is very low. The order size is still 100% of equity, not a 1,000× position. Do not read the 1000X in the title as live leverage; change the margin and size to match your venue before you rely on the tester.

Inputs (source defaults)

InputDefaultRole
DirectionlongTrade direction, either long or short. The default is long only; short switches to the short averages and stops new longs.
Long Entry MA Length190Long entry: buy when OBV crosses above this SMA.
Long Exit MA Length202Long exit: close the long when OBV crosses below this SMA.
Short MA Entry Length395Short entry: after Direction is set to short, sell when OBV crosses below this SMA. The input title is Short MA Entry Length.
Short Exit MA Length300Short exit: close the short when OBV crosses above this SMA. The default length is shorter than the short entry average.

Things to know before using it

  • The default size is 100% of equity, commission is 0.1%, slippage is 1 tick, and initial capital is 10,000. Live bitcoin fees and slippage often differ, so tester results are not a live forecast.
  • The 0.1% margin setting only changes how easily the tester can force a margin close. It does not turn a 100%-of-equity order into a 1,000× position. Do not treat the 1000X in the title as real leverage.
  • The default is long only. The 395 / 300 short averages are used for entries and exits only after you change Direction, though the source still calculates them either way.
  • OBV still adds volume on an unchanged close, unlike the common “do nothing on a flat close” version, so the line can differ slightly.
  • The exit average is not the same length as the entry average. By default a long waits for a cross of the slower 202-period average; if you set both lengths equal, entries and exits hug the same line more tightly.

Installing it on TradingView

  1. Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
  2. Open the Pine Editor, create a blank script, paste the full source, and save.
  3. Click Add to chart. To match the author image, start with COINBASE:BTCUSD on the 4-hour timeframe. The OBV line appears in a separate pane.
  4. Review the position size, commission, margin, and average lengths in the strategy properties, then inspect fills in the Strategy Tester.
  5. Past tester results do not guarantee future returns.

About backtest figures

Source, license and version

  • Source: https://www.tradingview.com/script/XlCRR2hE-OBVious-MA-Strategy-1000X-Trader/
  • Author: ThousandX_Trader. Source version 1.0 (Pine v5), scriptAccess=open_no_auth.
  • License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
  • Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue's rules.

Source, license and version

Licensed under MPL 2.0 per the source header, © ThousandX_Trader. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified source.

View original source ↗

Check the script license and your TradingView account features. Historical results do not guarantee future performance.

More strategies

All strategies →