Indicator · Pine Script v6 · Own pane

Capital41 Williams Flow Simple v2

by damianpitt· code credited to Capital41 | MIT License

Capital41 Williams Flow Simple calculates current and higher-timeframe Williams %R values alongside a volume filter to identify trend regimes and momentum entries.

View on GitHub

GitHub stars6on the repository
Pine versionv6current
Lines of code91
Settings7inputs
LicenceMIT
Last update8 weeks ago31 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

91 lines of Pine Script v6 from Capital41_Williams_Flow_Simple/Capital41_Williams_Flow_Simple_v2.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Capital41_Williams_Flow_Simple_v2.pine
// Copyright (c) 2026 Capital41 | MIT License
// CAPITAL41 WILLIAMS FLOW SIMPLE v2

// What it does:
// - Uses higher timeframe Williams %R as a regime filter (bull, bear, chop).
// - Triggers flow signals when current Williams %R exits oversold/overbought
//   with a volume confirmation.
// - Background shading shows the regime for quick context.
//
// v2 changes:
// - FIXED: Williams %R line color changed from color.black (invisible on dark
//   themes) to a user-configurable input color (default: teal).
//
// TradingView setup:
// 1) Open TradingView -> Pine Editor.
// 2) Paste this script, Save, and Add to chart.
// 3) Use 30m or 4h on BTC or US stocks.
// 4) Set Higher timeframe to 240 for 30m charts, or 1D for 4h charts.
//
// Usage guide (30m/4h):
// - Use Flow signals only in the direction of the HTF regime.
// - Avoid signals in chop (gray background).
// - Combine with sweeps or MA trend for higher quality entries.



//@version=6
indicator("Capital41 Williams Flow Simple v2", overlay = false, max_labels_count = 50)

// Inputs tuned for 30m-4H
len         = input.int(14, "Williams %R length", minval = 2)
htf         = input.timeframe("240", "Higher timeframe")
volLookback = input.int(50, "Volume SMA length", minval = 5)
volMult     = input.float(0.7, "Volume filter multiplier", minval = 0.1, maxval = 2.0)
showBg      = input.bool(true, "Show regime background")
showSignals = input.bool(true, "Show flow signals")
wrLineColor = input.color(color.teal, "Williams %R line color")  // v2: user-configurable color

colorBull = color.new(color.lime, 0)
colorBear = color.new(color.red, 0)
colorChop = color.new(color.gray, 90)


// Williams %R
wr_manual(_high, _low, _close, _len) =>
    hh = ta.highest(_high, _len)
    ll = ta.lowest(_low, _len)
    rng = hh - ll
    rng == 0 ? -50.0 : (hh - _close) / rng * -100

wrCurr = wr_manual(high, low, close, len)
wrHTF  = request.security(syminfo.tickerid, htf, wr_manual(high, low, close, len), lookahead = barmerge.lookahead_off)


// Regime
regimeBull = wrHTF > -45
regimeBear = wrHTF < -55
regimeChop = not (regimeBull or regimeBear)


// Volume filter
volSma = ta.sma(volume, volLookback)
volOK  = volume > volSma * volMult


// Flow signals
os = -80.0
ob = -20.0

flowLong  = showSignals and regimeBull and volOK and wrCurr > os and wrCurr[1] <= os and barstate.isconfirmed
flowShort = showSignals and regimeBear and volOK and wrCurr < ob and wrCurr[1] >= ob and barstate.isconfirmed


// Plots (v2: wrLineColor replaces color.black)
plot(wrCurr, title = "Williams %R", color = wrLineColor, linewidth = 2)
hline(os, "Oversold", color = color.new(colorBull, 50))
hline(ob, "Overbought", color = color.new(colorBear, 50))

bgcolor(showBg ? (regimeBull ? color.new(colorBull, 92) : regimeBear ? color.new(colorBear, 92) : colorChop) : na)

plotshape(flowLong, title = "Flow Long", style = shape.triangleup,
          location = location.bottom, color = colorBull, size = size.tiny, text = "L")

plotshape(flowShort, title = "Flow Short", style = shape.triangledown,
          location = location.top, color = colorBear, size = size.tiny, text = "S")

alertcondition(flowLong, title = "Flow Long",
               message = "Williams Flow: long signal on {{ticker}} ({{interval}})")

alertcondition(flowShort, title = "Flow Short",
               message = "Williams Flow: short signal on {{ticker}} ({{interval}})")

Overview

Capital41 Williams Flow Simple v2 defines bullish, bearish, or chop market regimes using the higher-timeframe Williams %R. Entry signals trigger in a separate pane when the current timeframe oscillator exits oversold or overbought zones with volume above a customizable moving average threshold, aligned with the higher-timeframe trend direction. Settings allow users to adjust timeframe inputs, volume filters, signal displays, and visual themes.

Details

Published by

damianpitt on GitHub

Code credit

Capital41 | MIT License, as written in the script's header

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Trend, Oscillators & momentum, Volume

Markets

Crypto, Stocks

Timeframes

M15-H1, H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

cryptoindicatorsmarket-structureorder-blockspinescriptsmart-moneytechnical-analysistechnical-analysis-indicatorstradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Williams %R lengthint14len
Higher timeframetimeframe240htf
Volume SMA lengthint50volLookback
Volume filter multiplierfloat0.7volMult
Show regime backgroundbooltrueshowBg
Show flow signalsbooltrueshowSignals
Williams %R line colorcolorcolor.tealwrLineColor
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

9 stars

FlowBias calculates a composite market momentum metric using Chaikin Money Flow, volume delta, Stochastic, and the Ultimate Oscillator. Plotted in a separate pane, it identifies trend pullbacks and market exhaustion reversals through visual signals and labels.

Indicator v6 TrendOscillators & momentum
Updated yesterday · MIT GitHub repository of FlowBias [WavesUnchained]

Nexural Pressure Pro

by JasonTeixeira
9 stars

Nexural Pressure Pro is a composite pressure indicator that measures directional market momentum using volume-weighted directional movement, order flow delta, aggression, and efficiency ratio metrics. It filters out low-activity bars using configurable volume

Indicator v6 Oscillators & momentumVolume
Updated 12 days ago · Custom licence GitHub repository of Nexural Pressure Pro

PaperHands

by lunarticktrading
7 stars

PaperHands is an indicator that plots entry, re-entry, and exit signals for LONG and SHORT positions in a separate pane. It calculates signals using multiple confluence conditions such as real candle color, Heikin-Ashi candle color and flat bottoms or tops, He

Indicator v6 TrendOscillators & momentum
Updated 2 weeks ago · None stated GitHub repository of PaperHands
4 stars

This indicator combines five normalized oscillator channels: RSI, stochastic, MACD histogram, money flow index, and the ADX directional difference. It cross-subtracts channel pairs with a fixed or correlation-based weight meant to reduce shared overlap, then s

Indicator v5 Oscillators & momentumVolume
Updated 6 months ago · None stated GitHub repository of MVSU Decontamination
3 stars

The Directional Flow Oscillator combines momentum, cumulative volume delta, price range position, trend ratio, and relative volatility into a single bounded composite indicator. It fetches lower-timeframe volume data to calculate cumulative volume delta and no

Indicator v5 Oscillators & momentumVolume
Updated 2 years ago · GPL-3.0 GitHub repository of Directional Flow Oscillator

Faith JL

by g-moe
3 stars

This indicator evaluates market sentiment and momentum using Aroon crossovers, intra-bar buy and sell volume estimation, and an ATR-based calculation. It generates modular buy and sell conditions filtered by volume thresholds, percentage bands, and Aroon signa

Indicator v5 VolumeTrend
Updated 5 months ago · None stated GitHub repository of Faith JL

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers