OPEN-SOURCE SCRIPT

Adaptive Supply and Demand [EdgeTerminal]

Adaptive Supply and Demand is a dynamic supply and demand indicator with a few unique twists. It considers volume pressure, volatility-based adjustments and multi-time frame momentum for confidence scoring (multi-step confirmation) to generate dynamic lines that adjust based on the market and also to generate dynamic support/resistance levels for the supply and demand lines.

The dynamic support and resistance lines shown gives you a better situational awareness of the current state of the market and add more context to why the market is moving into a certain direction.


> Trading Scenarios

When the confidence score is over 80%, strong volume pressure in trend direction (up or down), volatility is low and momentum is aligned across timeframes, there is an indication of a strong upward or downward trend.

When the supply and demand line crossover, the confidence score is over 75% and the volume pressure is shifting, this can be an indicator of trend reversal. Use tight initial stops, scale into position as trend develops, monitor the volume pressure for continuation and wait for confidence confirmation.

When the confiance score is below 60%, the volume pressure is choppy, volatility is high, you want to avoid trading or reduce position size, wait for confidence improvements, use support and resistance for entries/exits and use tighter stops due to market conditions. This is an indication of a ranging market.

Another scenario is when there is a sudden volume pressure increase, and a raising confidence score, the volatility is expanding and the bar momentum is aligning the volatility direction. This can indicate a breakout scenario.


> How it Works

1. Volume Pressure Analysis

Volume Pressure Analysis is a key component that measures the true buying and selling force in the market. Here's a detailed breakdown. The idea is to standardize volume to prevent large spikes from skewing results.

The indicator employs an adaptive volume normalization technique to detect genuine buying and selling pressure.

It takes current volume and divides it by average volume.

If normVol > 1: Current volume is above average

If normVol < 1: Current volume is below average

An example if this would be If current volume is 1500 and average is 1000, normVol = 1.5 (50% above average)

Another component of the volume pressure analysis is the Price Change Calculation sub-module. The purpose of this is to measure price movement relative to recent average.

It works by subtracting the average price from the current price. If the value is positive, price is average and if negative, price is below average.

Finally, the volume pressure is calculated to combine volume and price for true pressure reading.

2. Savitzky-Golay Filtering

SG filtering implements advanced signal smoothing while preserving important trend features. It uses weighted moving average approximation, preserves higher moments of data and reduces noise while maintaining signal integrity.

This results in smoother signal lines, reduced false crossovers and better trend identification. Traditional moving averages tend to lag and smooth out important features. Additionally, simple moving averages can miss critical turning points and regular smoothing can delay signal generation.

SG filtering preserves higher moments such as peaks, valleys and trends, reduces noise while maintaining signal sharpness.
It works by creating a symmetric weighting scheme. This way center points get the highest weights while edge points get the lowest weight.

3. Parkinson's Volatility

Parkinson's Volatility is an advanced volatility measurement formula using high-low range data. It uses high-low range for volatility calculation, incorporates logarithmic returns and annualized the volatility measure.

This results in more accurate volatility measurement, better risk assessment and dynamic signal sensitivity.

4. Multi-timeframe Momentum

This combines signals from each module for each timeframe to calculate momentum across three timeframes. It also applies weighted importance to each timeframe and generates a composite momentum signal.

This results in a more comprehensive trend analysis, reduced timeframe bias and better trend confirmation.


> Indicator Settings

Short-term Period:
Lower values makes it more sensitive, meaning it will generate more signals. Higher values makes it less sensitive, resulting in fewer signals. We recommend a 5 to 15 range for day trading, and 10 to 20 for swing trading

Medium-term Period:
Lower values result in faster trend confirmation and higher values show slower and more reliable confirmation. We recommend a range of 15-25 for day trading and 20-30 for swing trading.

Long-term Period:
Lower values makes it more responsive to trend changes and higher values are better for major trend identification. We recommend a range of 40-60 for day trading and 50-100 for swing trading.

Volume Analysis Window:
Lower values result in more sensitivity to volume changes and higher values result in smoother volume analysis. The optimal range is 15-25 for most trading styles.

Confidence Threshold:
Lower values generate more signals but quality decreases. Higher values generate fewer signals but accuracy increases.The optimal range is 0.65-0.8 for most trading conditions.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.