Indicator · Pine Script v6 · Own pane

Bill Williams Market Facilitation Index

by mihakralj

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero.

View on GitHub

GitHub stars99on the repository
Pine versionv6current
Lines of code43
Settings0inputs
LicenceApache-2.0
Last update4 weeks ago27 Sep 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

43 lines of Pine Script v6 from lib/oscillators/bw_mfi/bw_mfi.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

bw_mfi.pine
// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Bill Williams Market Facilitation Index (BW_MFI)", "BW_MFI", overlay=false)

//@function Bill Williams MFI with 4-zone classification
//@returns [mfi, zone] where zone: 1=Green, 2=Fade, 3=Fake, 4=Squat
//@optimized O(1) per bar — division + two comparisons
bw_mfi() =>
    float mfi = volume != 0 ? (high - low) / volume : 0.0
    float prev_mfi = nz(mfi[1])
    float prev_vol = nz(volume[1])

    int zone = na
    if bar_index < 1
        zone := 0
    else
        bool mfi_up = mfi > prev_mfi
        bool vol_up = volume > prev_vol
        if mfi_up and vol_up
            zone := 1    // Green: trend continuation
        else if not mfi_up and not vol_up
            zone := 2    // Fade: fading momentum
        else if mfi_up and not vol_up
            zone := 3    // Fake: unsupported price move
        else
            zone := 4    // Squat: accumulation/distribution
    [mfi, zone]

// ---------- Main loop ----------

[mfi_val, zone_val] = bw_mfi()

// Zone-based bar coloring
zone_color = switch zone_val
    1 => color.green    // Green zone
    2 => color.new(#8B4513, 0)  // Fade (brown)
    3 => color.blue     // Fake zone
    4 => color.fuchsia  // Squat zone
    => color.gray       // First bar / unknown

plot(mfi_val, title="BW_MFI", color=zone_color, style=plot.style_columns, linewidth=3)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dashed)

Overview

Bill Williams Market Facilitation Index compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for both falling, fake when the index rises on falling volume, and squat when the index falls on rising volume. Colored columns and a dashed zero line appear in a separate pane. No inputs are defined.

Details

Published by

mihakralj on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Volume, Oscillators & momentum

Markets

Any symbol

Timeframes

Any timeframe

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

algorithmic-tradingcsharpdotnetpinescriptpythonquantitative-financesimdta-libtechnical-analysistechnical-indicators

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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 4 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

Volume Flow Analysis

by iamrichardD
57 stars

This indicator calculates volume moving averages, volume spikes, and price-volume momentum to detect institutional order flow. It plots in a separate pane and generates visual signals for high-volume activity and flow persistence. Key inputs adjust the volume

Indicator v6 VolumeScalping
Updated 1 year ago · Apache-2.0 GitHub repository of Volume Flow Analysis

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