OPEN-SOURCE SCRIPT
Telah dikemas kini

Alma SD SuperTrend | Oquant

892
Alma SD SuperTrend | Oquant


The "Alma SD SuperTrend | Oquant" is a trend-following indicator that integrates the Arnaud Legoux Moving Average (ALMA) with a SuperTrend calculation based on standard deviation (SD). Designed to quickly identify and follow market trends while reducing noise, this script provides buy and sell signals for traders across various assets and timeframes.


This script offers a unique approach by combining ALMA with a SuperTrend framework that uses standard deviation instead of the traditional Average True Range (ATR). This implementation focuses on fast trend detection with minimized noise, making it suitable for trend-following or swing trading strategies. The script’s customizable parameters allow traders to adapt it to their preferred trading style.


How It Works
Arnaud Legoux Moving Average (ALMA): ALMA is an advanced moving average that applies a Gaussian filter to smooth price data, reducing market noise while preserving responsiveness to price changes. It uses three parameters:
Length: Sets the lookback period for smoothing. Longer periods produce smoother results.
Offset: Shifts the moving average toward recent prices. Higher offsets emphasize newer data for faster trend detection.
Sigma controls the smoothness and lag of the Alma by adjusting the spread of the Gaussian distribution used in the calculation.


Standard Deviation (SD) Calculation: The script calculates the standard deviation of the price over a specified period to measure volatility. SD measures how much the prices deviate from its mean, offering a statistical perspective on market volatility. This is used to create dynamic upper and lower bands around the ALMA line, adjusted by a user-defined factor. The bands expand in volatile markets and contract in stable conditions, helping in trend detection.


SuperTrend Logic: The script generates a SuperTrend line that dynamically tracks market trends by switching between upper and lower volatility bands based on price movement. Here's how it works:
The SuperTrend line is calculated using the ALMA (Arnaud Legoux Moving Average) as a baseline, with upper and lower bands created by adding and subtracting a multiple(Factor) of the standard deviation (SD) from the ALMA.
When the price moves above the upper band, the SuperTrend line shifts to the lower band, indicating a bullish trend (potential buy signal).
When the price falls below the lower band, the SuperTrend line switches to the upper band, signaling a bearish trend (potential sell signal).
To avoid quick, unreliable changes, this script intelligently adjusts the SuperTrend bands for stability. While the SuperTrend line dynamically follows market movements, it's designed to hold at its previous level if the price doesn't cross a band or confirm a new trend direction. This approach ensures the SuperTrend quickly identifies and follows genuine market trends, providing clear signals while effectively reducing false alerts from short-term price swings.


Differences from Traditional SuperTrend:
Baseline: The traditional SuperTrend typically uses a hl2((high + low)/2)as its baseline, while this script employs ALMA for a smoother, noise-filtered trend foundation.

Volatility Measure: Instead of ATR, this script uses standard deviation to calculate the bands. Standard deviation measures how much the prices vary or spread out from its mean.


Visualization: The script plots the SuperTrend line, colors candles to match the trend, and fills the area between the price and the SuperTrend line for visual clarity, helping traders quickly identify trend direction and strength (green for bullish, purple for bearish).


How to Use It

Add to Chart: Apply the indicator to any market and timeframe.
Interpret Signals:
Green Line and Candles: Bullish trend (price above the SuperTrend line). Consider long entries.
Purple Line and Candles: Bearish trend (price below the SuperTrend line). Consider short entries.
Filled Area: The shaded area between price and the SuperTrend line highlights trend direction(green for bullish, purple for bearish).


Adjust Inputs:

Source: Select the price data to use (e.g., close, open, high, low).

Factor: Adjusts band width. Higher values widen bands, reducing sensitivity.

SD Length: Period for calculating standard deviation. Longer periods smooth volatility.

ALMA Length: Period for ALMA. Longer periods increase smoothness.

Alma Offset: Shift the moving average toward recent or older prices. Higher offsets emphasize newer data for faster trend detection.

ALMA Sigma control the smoothness and lag of the Alma by adjusting the spread of the Gaussian distribution used in the calculation.


Alerts

This indicator includes optional built-in alert conditions that notify you when the signal crosses above 0 (long signal, price above upper band) or below 0 (short signal, price below lower band). Enable these alerts to get timely updates on potential trend shifts without constantly monitoring the chart.


⚠️ Disclaimer: This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate indicators/strategies before applying them in live markets. Use at your own risk.
Nota Keluaran
Added groups for the inputs

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.