OPEN-SOURCE SCRIPT

Demand Index - Metastock Version

154
This script implements the Demand Index, a complex technical indicator originally developed by James Sibbet. This specific version is adapted from the classic MetaStock formula to ensure accuracy and consistency with the original methodology.

The Demand Index combines price and volume data to relate price pressure to volume intensity. It is often used as a leading indicator to predict price trends by assessing the balance between buying pressure (Demand) and selling pressure (Supply).

How It Works
The calculation involves several steps to normalize volume and price changes:

Weighted Close: It calculates a weighted close price giving extra weight to the closing price (High + Low + 2*Close) / 4.
Volatility & Volume Averages: It computes the Average True Range (ATR) proxy and an Exponential Moving Average (EMA) of the volume to establish a baseline.
Buying & Selling Pressure: The core logic compares the current weighted close to the previous one.
If prices rise, the volume is assigned to Buying Pressure.
If prices fall, the volume is assigned to Selling Pressure.
A decay factor (Constant) is applied based on volatility to smooth the reaction to extreme price moves.
The Index: The final oscillator is derived from the ratio of smoothed Buying Pressure to Selling Pressure.
How to Use It
The Demand Index oscillates around a zero line. Traders typically look for the following signals:

Divergence: This is the most common use.
Bullish Divergence: Prices are making new lows, but the Demand Index is making higher lows. This suggests selling pressure is waning and a reversal may be imminent.
Bearish Divergence: Prices are making new highs, but the Demand Index is making lower highs. This suggests buying pressure is drying up.
Zero Line Crossovers:
A cross above zero indicates that Buying Pressure has overtaken Selling Pressure (Bullish).
A cross below zero indicates that Selling Pressure has overtaken Buying Pressure (Bearish).
Trend Confirmation: In a strong trend, the Demand Index should generally move in the same direction as the price.
Settings
Length: The lookback period for the moving averages (Default is 19, consistent with the standard MetaStock setting).
Originality & Credits
This script is a direct translation of the mathematical formula used in MetaStock software. While the Demand Index concept belongs to James Sibbet, this specific Pine Script implementation is provided as open source for the community to study and utilize.

Disclaimer:
This script is for educational and informational purposes only. It DOES NOT constitute financial advice. Trading involves significant risk, and past performance is not indicative of future results. Always do your own research before making investment decisions.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน