SBV Flow Trading For ThinkOrSwim

antwerks

Well-known member
VIP
VIP Enthusiast
1760432284920.png

The “SBV Flow Trading System (2 Signal Lines)” is a volume-based momentum indicator.
https://www.marketvolume.com/sbv/blog.asp

It shows whether big players are buying or selling and uses two smoothed ema lines to flag when that pressure shifts direction.

ComponentPurpose
SBV Formula(Close − Close[1]) × Volume measures whether volume supports price change.
Fast/Slow EMASmooth SBV values to reduce noise and show directional flow.
HistogramShows strength and direction of the flow (green = positive momentum).
CrossoversWhen the fast line crosses above the slow → bullish; below → bearish.
Labels/LinesOptional visual alerts for signal events.

shared study link: https://tos.mx/!2KgEYD93
Code:
# ==============================================================
# SBV Flow Trading System (Adaptive Version with Volatility Labels)
# --------------------------------------------------------------
# Displays volatility regime, ATR%, and adaptive factor.
# ==============================================================

declare lower;

# ---------- INPUTS ----------
input baseFastLength = 12;
input baseSlowLength = 26;
input atrLength      = 14;
input atrMultiplier  = 10;
input showHistogram  = yes;
input showSignals    = yes;
input showVolatilityLabels = yes;

# ---------- DEFINE GLOBAL COLORS ----------
DefineGlobalColor("FastLine", Color.CYAN);
DefineGlobalColor("SlowLine", Color.YELLOW);
DefineGlobalColor("HistUp",   Color.GREEN);
DefineGlobalColor("HistDown", Color.RED);
DefineGlobalColor("ZeroLine", Color.DARK_GRAY);
DefineGlobalColor("VolLow",   Color.LIGHT_GREEN);
DefineGlobalColor("VolNorm",  Color.LIGHT_GRAY);
DefineGlobalColor("VolHigh",  Color.ORANGE);

# ---------- VOLATILITY MEASURE ----------
def atr = Average(TrueRange(high, close, low), atrLength);
def atrPercent = atr / close * 100;
def adjFactor = Max(0.5, Min(2.0, 1 + (atrPercent / atrMultiplier - 0.1)));

# ---------- SBV BASE CALCULATION ----------
def SBV = (close - close[1]) * volume;

# ---------- CUSTOM DYNAMIC EMA ----------
def alphaFast = 2 / (baseFastLength / adjFactor + 1);
def alphaSlow = 2 / (baseSlowLength / adjFactor + 1);

rec fastLine = CompoundValue(1, fastLine[1] + alphaFast * (SBV - fastLine[1]), SBV);
rec slowLine = CompoundValue(1, slowLine[1] + alphaSlow * (SBV - slowLine[1]), SBV);

def hist = fastLine - slowLine;

# ---------- PLOTS ----------
plot pFast = fastLine;
pFast.SetDefaultColor(GlobalColor("FastLine"));
pFast.SetLineWeight(2);

plot pSlow = slowLine;
pSlow.SetDefaultColor(GlobalColor("SlowLine"));
pSlow.SetLineWeight(2);

plot pHist = if showHistogram then hist else Double.NaN;
pHist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
pHist.SetLineWeight(3);
pHist.AssignValueColor(
    if hist >= 0 then GlobalColor("HistUp")
    else GlobalColor("HistDown")
);

# ---------- SIGNALS ----------
def crossUp   = fastLine crosses above slowLine;
def crossDown = fastLine crosses below slowLine;

AddVerticalLine(showSignals and crossUp, "BUY", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(showSignals and crossDown, "SELL", Color.RED, Curve.SHORT_DASH);

AddLabel(showSignals and crossUp, "SBV Bullish Crossover", Color.GREEN);
AddLabel(showSignals and crossDown, "SBV Bearish Crossover", Color.RED);

# ---------- ZERO LINE ----------
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GlobalColor("ZeroLine"));
ZeroLine.SetStyle(Curve.LONG_DASH);
ZeroLine.HideBubble();

# ---------- VOLATILITY LABELS ----------
def volRegime =
    if atrPercent < 0.75 then 0
    else if atrPercent < 2 then 1
    else 2;

# Always show labels (no need for lastBar check)
AddLabel(showVolatilityLabels,
    "ATR%: " + Round(atrPercent, 2) + "%",
    if volRegime == 0 then GlobalColor("VolLow")
    else if volRegime == 1 then GlobalColor("VolNorm")
    else GlobalColor("VolHigh")
);

AddLabel(showVolatilityLabels,
    "Adaptive Factor: " + Round(adjFactor, 2),
    Color.LIGHT_GRAY
);

AddLabel(showVolatilityLabels,
    if volRegime == 0 then "Volatility: LOW"
    else if volRegime == 1 then "Volatility: NORMAL"
    else "Volatility: HIGH",
    if volRegime == 0 then GlobalColor("VolLow")
    else if volRegime == 1 then GlobalColor("VolNorm")
    else GlobalColor("VolHigh")
);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
854 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top