Quantified Trader

How to use Demand Index for perfect entry-exit signals

In the world of technical analysis, traders and investors are constantly searching for indicators that can provide valuable insights into market trends and potential reversals. The Demand Index, developed by James Sibbet, is one such technical indicator that combines price and volume to assess buying and selling pressure affecting security.

In this article, we will explore the intricacies of the Demand Index, its calculation methodology, and how it can be utilized as a leading indicator in trading strategies.

Understanding the Demand Index

The Demand Index is a unique oscillator that measures the ratio of buying pressure to selling pressure in the market. It takes into account price change rate, volume, and volatility, making it a comprehensive indicator for trend analysis.

 By combining price and volume in its calculation, the Demand Index often acts as a leading indicator, providing insights into potential price changes before they occur.

Demand Index = \frac{{\text{{Close}} - \text{{Open}}}}{{\text{{High}} - \text{{Low}}}} \times \text{{Volume}}

In this formula, the Demand Index is calculated by taking the difference between the closing price (Close) and the opening price (Open), divided by the difference between the highest price (High) and the lowest price (Low), and then multiplied by the trading volume (Volume).

This formula combines price and volume information to assess the buying and selling pressure in the market and is often used as a leading indicator for trend analysis.

def calculate_demand_index(open_prices, high_prices, low_prices, close_prices, volumes):
    demand_index = []
    for i in range(len(close_prices)):
        numerator = close_prices[i] - open_prices[i]
        denominator = high_prices[i] - low_prices[i]
        demand_index.append((numerator / denominator) * volumes[i])
    return demand_index

How to Interpret Demand Index to Predict Market Trend

The calculation of the Demand Index involves a complex formula. It compares buying pressure to selling pressure and determines the ratio between the two.

If the buying pressure exceeds the selling pressure, the index is assumed to be positive, indicating a potential bullish trend.

Conversely, if the selling pressure outweighs the buying pressure, the index is negative, suggesting a potential bearish trend.

Traders often look for divergences between the Demand Index and price movements, as these can be indicative of impending trend reversals.

Python Code to calculate the demand Index using OHLCV data

import yfinance as yf
import plotly.graph_objects as go

# Fetch OHLCV data for Tesla stock
tesla = yf.Ticker("TSLA")
data = tesla.history(period="1y")

# Extract OHLCV data
open_prices = data['Open'].values
high_prices = data['High'].values
low_prices = data['Low'].values
close_prices = data['Close'].values
volumes = data['Volume'].values

# Calculate Demand Index
demand_index = calculate_demand_index(open_prices, high_prices, low_prices, close_prices, volumes)

# Create a Plotly figure with two traces
fig = go.Figure()

# Add adjusted closing prices trace
fig.add_trace(go.Scatter(x=data.index, y=data['Adj Close'], name='Adjusted Close'))

# Add Demand Index trace
fig.add_trace(go.Scatter(x=data.index, y=demand_index, name='Demand Index'))

# Update layout
fig.update_layout(title='Tesla Stock Analysis',
                  xaxis_rangeslider_visible=False,
                  height=600,
                  width=800)

# Show the chart
fig.show()

List of top 250 Technical Indicators used in Chart Analysis

How to Use Demand Index to Build Trading Strategies

The demand Index offers several useful trading strategies when incorporated into a comprehensive trading plan. Here are some key rules for utilizing the Demand Index effectively:

Divergence signal with Demand Index

When a divergence occurs between the Demand Index and price, where the price moves in one direction while the Demand Index moves in the opposite direction, it is often considered a bearish signal. This divergence suggests a potential weakness in the current trend.

Extreme Peaks in Demand Index

After reaching an extreme peak in the Demand Index, prices often rally to new highs. This indicates that despite the peak in buying pressure, the market still has room to advance.

Low Demand Index with Higher Prices

If prices rise while the Demand Index remains low, it may indicate a potential market top. This discrepancy suggests that buying pressure is insufficient to sustain further upward momentum.

Crossing the Zero Line

When the Demand Index moves through the zero line, it suggests a change in trend. Crossing from negative to positive indicates a potential bullish reversal, while crossing from positive to negative suggests a potential bearish reversal.

Near-Zero Levels

If the Demand Index remains near the zero line, it indicates weak price movement that is unlikely to persist for an extended period. Traders should be cautious when making decisions based on such conditions.

Long-Term Divergence Strategy

A long-term divergence between the Demand Index and price is a powerful signal, often predicting a major top or bottom in the market. Traders should pay close attention to this type of divergence as it can indicate significant trend reversals.

For more information on Quantitative Finance, Visit QuantEdX

Conclusion

The Demand Index is a valuable tool for traders and investors seeking to gain insights into market trends and potential reversals. By combining price and volume data, it offers a comprehensive assessment of buying and selling pressure in the market. However, traders should remember that the Demand Index is most effective when used in conjunction with other technical indicators and chart patterns. By integrating the Demand Index into a well-rounded trading strategy, market participants can enhance their decision-making process and improve their chances of success.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top