Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Volume Flow Indicator by LazyBear

Volume Flow Indicator by LazyBear, explained from the source

Volume Flow Indicator [LazyBear] is an open-source TradingView indicator by LazyBear, published in June 2014, with about 27,300 boosts. On the chart it is called "VFI_LB". It is LazyBear's port of the Volume Flow Indicator that Markos Katsanos described: a running total of volume, counted as positive on bars where the typical price rose enough, negative where it fell enough, and zero in between. This page walks through the published code in order, says what each part does, and ends with where it fails. It does not say what any reading means for the next move.

The surprise: the smoothing is off, and the picture uses other settings

Two things differ from what most readers expect. First, the code has a "smoothVFI" switch that applies a 3-bar average to the line, which is how Katsanos defined it, and the switch is off by default. With it off, the line is the raw sum. In our port on invented prices, the raw line crossed its signal line about 1.6 times as often as the smoothed one (227 to 233 crosses per 1,000 bars against 140 to 145). Second, the chart shown on the script's own page was made with a coefficient of 0.1 and a signal length of 10, while the defaults you get when you add the script are 0.2 and 5. So the indicator on your chart will not look like the one in the picture until you change two inputs.

Step 1: the typical price and its change

The script uses the typical price, the average of high, low and close, for each bar. It takes the change in the log of that price from the previous bar, and the standard deviation of those changes over the last 30 bars. That standard deviation, times the coefficient (default 0.2), times the current close, gives a cutoff in price units. Note the mix: the cutoff is scaled by the close, while the change it is compared with is the change in the typical price.

Step 2: which bars count, and how much

For each bar, the change in typical price is compared with the cutoff. If it rose by more than the cutoff, the bar's volume counts as positive. If it fell by more than the cutoff, it counts as negative. Anything in between counts as zero. Before counting, volume is capped: the average volume of the previous 130 bars (not including the current one), times the "Max. vol. cutoff" (default 2.5), is the most a single bar can add. A bar with ten times normal volume adds the same as a bar with 2.5 times.

Step 3: the line and the signal line

The counted volumes of the last 130 bars ("VFI length") are added up and divided by the average volume from Step 2. That ratio is the VFI line, smoothed by 3 bars only if "smoothVFI" is on. A second line is an exponential average of it over 5 bars ("signalLength"). A dashed zero line and an optional histogram of the gap between the two lines complete the plot. There is nothing else: no colouring by sign, no markers, and no alert conditions.

What the settings change

"VFI length" (130) sets both the window of the volume sum and the window of the average volume it is divided by, and so how long the script needs before it draws anything. The unnamed coefficient (0.2) sets the width of the dead zone: higher means more bars count as zero. "Max. vol. cutoff" (2.5) sets the volume cap as a multiple of the average. "signalLength" (5) sets the signal line. "smoothVFI" (off) adds the 3-bar average. The 30-bar window for the volatility is fixed in the code.

What we checked in Python

We ported the whole calculation to Python and ran it on invented random-walk prices with random volume, three runs of 20,000 bars. With the default settings, 14% to 15% of bars fell in the dead zone and counted zero volume, and about 3.5% of bars were cut by the volume cap. The first value appeared at bar 259, because the 130-bar sum needs a 130-bar average before it can start. The line crossed its signal line 227 to 233 times per 1,000 bars with smoothing off and 140 to 145 with it on, and crossed zero 34 to 36 times against 22 to 23. With the page picture's settings (coefficient 0.1, signal 10), the dead zone halved to about 7% of bars and the signal crosses fell to 164 to 177 per 1,000. These figures describe the code on invented data, where there is nothing to find, not any market.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Volume Flow Indicator [LazyBear] is by LazyBear on TradingView, a port of Markos Katsanos' Volume Flow Indicator; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and volume and say nothing about how the script trades.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Before you trust its backtest: the Integrity Checklist, $19 one-offBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.