The GAS Price Levels Technical Indicator is a sophisticated multi-factor technical analysis tool designed for natural gas trading. It combines traditional technical indicators with advanced alpha factors, utilizing a dynamic weighting system based on Information Coefficients (IC) to adapt to volatile market conditions. This indicator provides comprehensive price level analysis, enabling traders to identify support and resistance zones with high precision.
- Advanced Technical Indicators: Integrates Bollinger Bands, KAMA, RSI, CCI, ATR, Williams %R, and MACD for robust price analysis.
- Dynamic Weighting System: Automatically adjusts indicator weights based on recent predictive power using Information Coefficients.
- Mathematical Foundations: Employs cumulative log returns, rate of change (ROC), and correlation calculations to enhance analysis accuracy.
- Performance Optimized: Utilizes efficient
ta.*
functions to ensure minimal computational overhead and prevent repainting. - Risk Management Tools: Incorporates multiple timeframe analysis and volatility-based risk adjustments for effective position sizing.
-
Bollinger Bands (BB)
- Length: 20 periods (customizable)
- Standard Deviation: 2.0 (customizable)
- Implementation:
ta.bb(close, bbandsLength, bbandsStdDev)
- Provides dynamic support/resistance levels based on volatility
-
Kaufman's Adaptive Moving Average (KAMA)
- Length: 10 periods
- Implementation:
ta.ema(close, 10)
- Adapts to market volatility for more responsive trend following
-
Additional Supporting Indicators
- RSI (Relative Strength Index): 14-period default
- CCI (Commodity Channel Index): 20-period default
- ATR (Average True Range): 10-period default
- Williams %R: 14-period default
- MACD: (12, 26, 9) standard parameters
cumLogReturn40d = ta.cum(math.log(close / close[1]))
alpha238 = ta.lowestbars(cumLogReturn40d, 40)
Mathematical foundation:
- Calculates cumulative log returns over 40 days
- Identifies historical price patterns through minimum return periods
- Effective for mean reversion strategies
alpha51 = ta.roc(close, 30) * ta.roc(close, 5)
Properties:
- Combines long-term (30-period) and short-term (5-period) price momentum
- Identifies momentum divergences and convergences
- Multiplication effect amplifies significant price moves
alpha262 = ta.change(ta.sma(math.pow(cci, 2), cciLength))
Characteristics:
- Squares CCI values to emphasize extreme movements
- Applies smoothing through SMA
- Tracks rate of change in volatility
The indicator implements a sophisticated dynamic weighting system based on Information Coefficients (IC):
float ic_238 = ta.correlation(alpha238, ta.change(close), 20)
float ic_51 = ta.correlation(alpha51, ta.change(close), 20)
float ic_262 = ta.correlation(alpha262, ta.change(close), 20)
float total_ic = math.abs(ic_238) + math.abs(ic_51) + math.abs(ic_262)
float w238 = math.abs(ic_238) / total_ic
- Calculates 20-period correlation between each alpha and price changes
- Takes absolute values to focus on strength rather than direction
- Normalizes weights by dividing by total IC
- Automatically adjusts factor importance based on recent predictive power
Parameter | Default | Description |
---|---|---|
emaPeriods | 9 | EMA calculation length |
atrLength | 10 | ATR calculation period |
bbandsLength | 20 | Bollinger Bands period |
bbandsStdDev | 2.0 | BB standard deviation multiplier |
rsiLength | 14 | RSI calculation period |
cciLength | 20 | CCI calculation period |
The indicator displays several overlay elements on the price chart:
- Bollinger Bands (Upper, Middle, Lower) in blue/white with 80% transparency
- KAMA line in orange with 80% transparency
-
Performance Considerations
- Uses efficient
ta.*
built-in functions for optimal performance - Implements look-back periods carefully to minimize repainting
- Calculations are streamlined to reduce computational overhead
- Uses efficient
-
Risk Management
- Multiple timeframe analysis recommended (indicator works on any timeframe)
- Use in conjunction with position sizing based on ATR values
- Consider BB width for volatility-based risk adjustment
- TradingView Pine Script version 6
- Real-time or delayed data feed for natural gas prices
- Open TradingView Chart
- Go to Pine Editor
- Create New Indicator
- Copy and paste the provided code
- Add to Chart
MIT License
Denizhan Dakılır