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.
Component | Purpose |
---|---|
SBV Formula | (Close − Close[1]) × Volume measures whether volume supports price change. |
Fast/Slow EMA | Smooth SBV values to reduce noise and show directional flow. |
Histogram | Shows strength and direction of the flow (green = positive momentum). |
Crossovers | When the fast line crosses above the slow → bullish; below → bearish. |
Labels/Lines | Optional 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: