OPEN-SOURCE SCRIPT
Cập nhật

Adaptive ALMA 2.0

6 531
This script is a indicator that builds upon the Arnaud Legoux Moving Average (ALMA). Unlike a standard ALMA, which uses fixed settings, this version is "Adaptive" and "Evasive."
Here is a breakdown of what the code is doing:

1. The Adaptive Engine (Efficiency Ratio)

The core logic uses an Efficiency Ratio (ER) to measure market noise versus trend strength:
High Volatility/Clear Trend: The ER is high. The script automatically shortens the length and reduces the offset to make the line react faster (minimizing lag).
Low Volatility/Consolidation: The ER is low. The script increases the length and sigma to make the line smoother, preventing "whipsaws" (fake signals).

2. Global Evasion Engine (Noise Filtering)

This is the most unique part of the script. It uses two ATRs (Fast and Slow) to create a "Noise Zone":
Auto-Tune Evasion: It calculates a visual_noise_th (threshold). If the price is wiggling inside this gray/aqua band, the trend state won't change easily.
Volatility-Based Sensitivity: In "noisy" markets, it requires a larger price move (determined by d_atr) to flip the trend from Bullish to Bearish.
PS1: ATR is calculated on the full range of candle prices - open + close

3. Trend Logic & Signals

Bullish (Green): When the ALMA is rising, the price is above it, and the move exceeds the noise threshold.
Bearish (Red): When the ALMA is falling, the price is below it, and the move exceeds the noise threshold.
Neutral (Gray): When the price is stuck within the "Noise Band."

4. Extra Layers

It includes Medium (50) and Long (200) ALMA lines to give you a broader context of the trend (e.g., only taking Buy signals when the Long ALMA is also green).
Source: It uses a custom price source (open + close + close) / 3 to give more weight to the closing price while maintaining some "breath" from the open.

PS2: the sample chart is for BTC with a 5-minute interval
PS3: Works on any interval - you only need to adjust the parameters, default values ​​are for fast-moving and liquid assets (e.g. BTC intervals 1 minute - 1 day and higher) and suggested Japanese candles (including Heikin Ashi)
Phát hành các Ghi chú
- Added additional options (timeframe = '', timeframe_gaps = false) - Change the time frame and set the marker after the end of the time interval (prevents "repainting")
- Added offset options for drawing markers on the main chart
- Minor changes to the arguments panel (coloring moved to the styles panel)
- Slightly changed the coloring selection for averages (Adaptive ALMA first)
- Minor option change - FIXED ALMA medium and ALMA long averages are active by default - this is intended to enable the full range of indicator options.

The script does not repaint historical markers - the only option that "gives the impression of flickering" is the variability of the marker's appearance during the CURRENT candlestick until the end of the interval (candlestick), i.e., during the trading period of a given interval. This can be prevented by using the option from the first patch at the very top.
Phát hành các Ghi chú
- Fixed several bugs
- Added Bollinger Bands with crossover markers
- Changed default settings to more universal ones (working on standard and Heikin Ashi candles)
- Added the "source" line as a guide
- For traditionalists, the code includes a hidden price switch for a standard set of price data (close, hlc, ohlc4, etc.) – just unlock and use.

I think this is the final version – it can be used as a ready-made system.
Phát hành các Ghi chú
minor code changes
Phát hành các Ghi chú
minor code fixes

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.