OPEN-SOURCE SCRIPT
已更新 - Standardized Money Flow Index with Multi-MA and BB Overlay

This custom Money Flow Index (MFI) script enhances the standard MFI by introducing multiple layers of configurability, statistical normalization, and visual clarity. It begins with the traditional MFI calculation using the average price, hlc3, and a user-defined length, then offers the option to standardize the output. Standardization transforms the MFI into a z-score by subtracting a rolling mean and dividing by a rolling standard deviation, making the indicator statistically interpretable across different assets, timeframes, and volatility regimes. When standardization is active, the overbought and oversold thresholds shift from the conventional 80 and 20 to +2 and –2, aligning them with standard deviation boundaries and improving signal clarity in volatile environments.
Beyond standardization, the script introduces a robust smoothing engine. Users can choose from several moving average types, including SMA, EMA, SMMA (RMA), WMA, and VWMA, to reduce noise and highlight trend shifts. A particularly advanced option is the “SMA + Bollinger Bands” mode, which overlays volatility envelopes around the smoothed MFI using a user-defined standard deviation multiplier. This feature helps traders identify when the MFI is unusually high or low relative to its recent behaviour, adding a volatility-adjusted layer of insight, especially useful in momentum or mean-reversion setups.
Visually, the script is designed for clarity, modularity, and flexibility. It plots the raw or standardized MFI in purple, overlays the smoothed version in yellow if enabled, and adds green Bollinger Bands when selected. It also includes horizontal reference lines for overbought, oversold, and midpoint levels, which dynamically adjust based on whether standardization is active. A shaded background between the overbought and oversold lines further enhances readability, helping traders quickly assess momentum extremes and potential inflection zones.
Compared to the standard MFI, which offers a fixed calculation, limited visual feedback, and no statistical context, this enhanced version is modular, customizable, and statistically grounded. It allows traders to tailor the indicator to their strategy, whether they prefer raw signals, smoothed trends, or volatility-adjusted extremes. These enhancements make it a powerful building block for more sophisticated signal engines, especially when combined with filter gating, persistent state logic, or multi-indicator overlays.
Beyond standardization, the script introduces a robust smoothing engine. Users can choose from several moving average types, including SMA, EMA, SMMA (RMA), WMA, and VWMA, to reduce noise and highlight trend shifts. A particularly advanced option is the “SMA + Bollinger Bands” mode, which overlays volatility envelopes around the smoothed MFI using a user-defined standard deviation multiplier. This feature helps traders identify when the MFI is unusually high or low relative to its recent behaviour, adding a volatility-adjusted layer of insight, especially useful in momentum or mean-reversion setups.
Visually, the script is designed for clarity, modularity, and flexibility. It plots the raw or standardized MFI in purple, overlays the smoothed version in yellow if enabled, and adds green Bollinger Bands when selected. It also includes horizontal reference lines for overbought, oversold, and midpoint levels, which dynamically adjust based on whether standardization is active. A shaded background between the overbought and oversold lines further enhances readability, helping traders quickly assess momentum extremes and potential inflection zones.
Compared to the standard MFI, which offers a fixed calculation, limited visual feedback, and no statistical context, this enhanced version is modular, customizable, and statistically grounded. It allows traders to tailor the indicator to their strategy, whether they prefer raw signals, smoothed trends, or volatility-adjusted extremes. These enhancements make it a powerful building block for more sophisticated signal engines, especially when combined with filter gating, persistent state logic, or multi-indicator overlays.
版本注释
- Updated visuals to include all available smoothing functions开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。