OPEN-SOURCE SCRIPT

CMF and Scaled EFI Overlay

已更新
CMF and Scaled EFI Overlay Indicator

Overview

The CMF and Scaled EFI Overlay indicator combines the Chaikin Money Flow (CMF) and a scaled version of the Elder Force Index (EFI) into a single chart. This allows traders to analyze both indicators simultaneously, facilitating better insights into market momentum and volume dynamics, specifically focusing on buying/selling pressure and momentum, without compromising the integrity of either indicator.

Purpose

  • Chaikin Money Flow (CMF): Measures buying and selling pressure by evaluating price and volume over a specified period. It indicates accumulation (buying pressure) when values are positive and distribution (selling pressure) when values are negative.
  • Elder Force Index (EFI): Combines price changes and volume to assess the momentum behind market moves. Positive values indicate upward momentum (prices rising with strong volume), while negative values indicate downward momentum (prices falling with strong volume).


By scaling the EFI to match the amplitude of the CMF, this indicator enables a direct comparison between pressure and momentum, preserving their shapes and zero crossings. Traders can observe the relationship between price movements, volume, and momentum more effectively, aiding in decision-making.

Understanding Pressure vs. Momentum

  • Chaikin Money Flow (CMF):
    - Indicates the level of demand (buying pressure) or supply (selling pressure) in the market based on volume and price movements.
    - Accumulation: When institutional or large investors are buying significant amounts of an asset, leading to an increase in buying pressure.
    - Distribution: When these investors are selling off their holdings, increasing selling pressure.
  • Elder Force Index (EFI):
    - Measures the strength and speed of price movements, indicating how forceful the current trend is.
    - Positive Momentum: Prices are rising quickly, indicating a strong uptrend.
    - Negative Momentum: Prices are falling rapidly, indicating a strong downtrend.



Understanding the difference between pressure and momentum is crucial. For example, a market may exhibit strong buying pressure (positive CMF) but weak momentum (low EFI), suggesting accumulation without significant price movement yet.

Features

  • Overlay of CMF and Scaled EFI: Both indicators are plotted on the same chart for easy comparison of pressure and momentum dynamics.
  • Customizable Parameters: Adjust lengths for CMF and EFI calculations and fine-tune the scaling factor for optimal alignment.
  • Preserved Indicator Integrity: The scaling method preserves the shape and zero crossings of the EFI, ensuring accurate analysis.


How It Works

  1. CMF Calculation:
    - Calculates the Money Flow Multiplier (MFM) and Money Flow Volume (MFV) to assess buying and selling pressure.
    - CMF is computed by summing the MFV over the specified length and dividing by the sum of volume over the same period:
  2. EFI Calculation:
    - Calculates the EFI using the Exponential Moving Average (EMA) of the price change multiplied by volume:
  3. Scaling the EFI:
    - The EFI is scaled by multiplying it with a user-defined scaling factor to match the CMF's amplitude.
  4. Plotting:
    - Both the CMF and the scaled EFI are plotted on the same chart.
    - A zero line is included for reference, aiding in identifying crossovers and divergences.


Indicator Settings

Inputs

  • CMF Length (`cmf_length`):
    - Default: 20
    - Description: The number of periods over which the CMF is calculated. A higher value smooths the indicator but may delay signals.
  • EFI Length (`efi_length`):
    - Default: 13
    - Description: The EMA length for the EFI calculation. Adjusting this value affects the sensitivity of the EFI to price changes.
  • EFI Scaling Factor (`efi_scaling_factor`):
    - Default: 0.000001
    - Description: A constant used to scale the EFI to match the CMF's amplitude. Fine-tuning this value ensures the indicators align visually.


How to Adjust the EFI Scaling Factor

  1. Start with the Default Value:
    - Begin with the default scaling factor of `0.000001`.
  2. Visual Inspection:
    - Observe the plotted indicators. If the EFI appears too large or small compared to the CMF, proceed to adjust the scaling factor.
  3. Fine-Tune the Scaling Factor:
    - Increase or decrease the scaling factor incrementally (e.g., `0.000005`, `0.00001`, `0.00005`) until the amplitudes of the CMF and EFI visually align.
    - The optimal scaling factor may vary depending on the asset and timeframe.
  4. Verify Alignment:
    - Ensure that the scaled EFI preserves the shape and zero crossings of the original EFI.
    - Overlay the original EFI (if desired) to confirm alignment.


How to Use the Indicator

  1. Analyze Buying/Selling Pressure and Momentum:
    - Positive CMF (>0): Indicates accumulation (buying pressure).
    - Negative CMF (<0): Indicates distribution (selling pressure).
    - Positive EFI: Indicates positive momentum (prices rising with strong volume).
    - Negative EFI: Indicates negative momentum (prices falling with strong volume).
  2. Look for Indicator Alignment:
    - Both CMF and EFI Positive:
    - Suggests strong bullish conditions with both buying pressure and upward momentum.
    - Both CMF and EFI Negative:
    - Indicates strong bearish conditions with selling pressure and downward momentum.
  3. Identify Divergences:
    - CMF Positive, EFI Negative:
    - Buying pressure exists, but momentum is negative; potential for a bullish reversal if momentum shifts.
    - CMF Negative, EFI Positive:
    - Selling pressure exists despite rising prices; caution advised as it may indicate a potential bearish reversal.
  4. Confirm Signals with Other Analysis:
    - Use this indicator in conjunction with other technical analysis tools (e.g., trend lines, support/resistance levels) to confirm trading decisions.


Example Usage

Scenario 1: Bullish Alignment

- CMF Positive: Indicates accumulation (buying pressure).
- EFI Positive and Increasing: Shows strengthening upward momentum.
- Interpretation:
- Strong bullish signal suggesting that buyers are active, and the price is likely to continue rising.
- Action:
- Consider entering a long position or adding to existing ones.

Scenario 2: Bearish Divergence

- CMF Negative: Indicates distribution (selling pressure).
- EFI Positive but Decreasing: Momentum is positive but weakening.
- Interpretation:
- Potential bearish reversal; price may be rising but underlying selling pressure suggests caution.
- Action:
- Be cautious with long positions; consider tightening stop-losses or preparing for a possible trend reversal.

Tips

  • Adjust for Different Assets:
    - The optimal scaling factor may differ across assets due to varying price and volume characteristics.
    - Always adjust the scaling factor when analyzing a new asset.
  • Monitor Indicator Crossovers:
    - Crossings above or below the zero line can signal potential trend changes.
  • Watch for Divergences:
    - Divergences between the CMF and EFI can provide early warning signs of trend reversals.
  • Combine with Other Indicators:
    - Enhance your analysis by combining this overlay with other indicators like moving averages, RSI, or Ichimoku Cloud.


Limitations

  • Scaling Factor Sensitivity:
    - An incorrect scaling factor may misalign the indicators, leading to inaccurate interpretations.
    - Regular adjustments may be necessary when switching between different assets or timeframes.
  • Not a Standalone Indicator:
    - Should be used as part of a comprehensive trading strategy.
    - Always consider other market factors and indicators before making trading decisions.


Disclaimer

  • No Guarantee of Performance:
    - Past performance is not indicative of future results.
    - Trading involves risk, and losses can exceed deposits.
  • Use at Your Own Risk:
    - This indicator is provided for educational purposes.
    - The author is not responsible for any financial losses incurred while using this indicator.


Code Summary



- Lines 4-6: Define input parameters for CMF length, EFI length, and EFI scaling factor.
- Lines 9-11: Calculate the CMF.
- Lines 14-16: Calculate the EFI.
- Line 19: Scale the EFI by the scaling factor.
- Lines 22-24: Plot the CMF, scaled EFI, and zero line.

Feedback and Support

  • Suggestions: If you have ideas for improvements or additional features, please share your feedback.
  • Support: For assistance or questions regarding this indicator, feel free to contact the author through TradingView.


---

By combining the CMF and scaled EFI into a single overlay, this indicator provides a powerful tool for traders to analyze market dynamics more comprehensively. Adjust the parameters to suit your trading style, and always practice sound risk management.
發行說明
Improved CMF and EFI Scaling with Adaptive Lookback

  • Enhanced EFI scaling using a robust interquartile range method for dynamic adaptability.
  • Added adaptive lookback period selection based on timeframe, improving visualization across various chart resolutions.
  • Included optional background color visualization for trend insights.
  • Addressed potential compression issues by allowing individual overlays of each indicator for accurate scaling comparison.
發行說明
Updated the chart image
發行說明
Updated default lookback intervals
發行說明
Update smoothing to false by default
發行說明
Update chart image
發行說明
Update Chart line names and update chart image to comply with community guidelines.
發行說明
Another update to chart image. Last one had random text in the middle.
發行說明
Update Chart Image
發行說明
Final update to chart image
accumulation_distributionchaikin_money_flowElder's Force Index (EFI)momentumindicatorMomentum OscillatorsmoneyflowanalysisOscillatorsoverlayTrend AnalysisVolume Indicatorvolumeanalysisvolumeweighted

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明