OPEN-SOURCE SCRIPT

Money Flow based probability

384
Money Flow based probability

This indicator provides a comprehensive correlation and momentum analysis between your main asset and up to three selected correlated assets. It combines correlation, trend, momentum, and overbought/oversold signals into a single, easy-to-read table directly on your chart.

  1. Correlated Asset Selection:
    You can select up to three correlated assets (e.g., indices, currencies, bonds) to compare with your main chart symbol. Each asset can be toggled on or off.

  2. Correlation Calculation:
    The indicator uses the native Pine Script
    Pine Script®
    ta.correlation
    function to measure the statistical relationship between the closing prices of your asset and each selected pair over a user-defined period.

  3. Technical Analysis Integration:
    For each asset (including the main one), the indicator calculates:
    Trend direction using EMA (Exponential Moving Average) – optional
    Momentum using MACD – optional
    Overbought/oversold status using RSI – optional
  4. Probability Scoring:
    A weighted scoring system combines correlation, trend, MACD, RSI, and trend exhaustion signals to produce buy and sell probabilities for the main asset.

  5. Visual Table Output:
    A customizable table is displayed on the chart, showing:
    Asset name
    Correlation (as a percentage, -100% to +100%)
    Trend (Bullish/Bearish)
    MACD status (Bullish/Bearish)
    RSI value and status
    Buy/Sell probability (with fixed-width formatting for stability)
  6. User Customization:
    You can adjust:
    • Table size, color, and position
    • Correlation period
    • EMA, MACD, and RSI parameters
    • Which assets to display


This indicator is ideal for traders who want to quickly assess the influence of major correlated markets and technical signals on their trading instrument, all in a single glance.

---

Example: Correlation Calculation
Pine Script®
corrCurrentAsset1 = ta.correlation(close, asset1Data, correlationPeriod)


Example: Table Output (Buy/Sell %)
Pine Script®
buyStr = f_formatPercent(buyProbability) + "%" sellStr = f_formatPercent(sellProbability) + "%" cellStr = buyStr + " / " + sellStr

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.