OPEN-SOURCE SCRIPT
Adaptive Trend Step[NeuraAlgo]

Adaptive Trend Step[NeuraAlgo]
Overview
Purpose / Description
The Adaptive Trend Step indicator is designed to track price trends while adapting to market volatility 🌊. It uses adaptive volatility scaling ⚖️ to create a dynamic step-like trend line 📈📉, helping traders identify uptrends 🔵, downtrends 🟠, and neutral phases 🟣. The line adjusts automatically depending on market volatility, making it responsive in fast markets ⚡ and smooth in quiet markets ✨.

How It Works
Efficiency Ratio (ER) ⚡
• Measures the strength of the current price movement relative to recent price changes.
Formula:
ER = (absolute change over 'length') / (sum of absolute changes over 'length')
• ER ranges 0–1, indicating strong trends (closer to 1) or sideways markets (closer to 0).
Adaptive Standard Deviation (Adaptive Dev) 📏
Combines fast and slow standard deviations, weighted by ER:
Adaptive Dev = ER * fast_dev + (1 - ER) * slow_dev
• Creates a tight threshold in strong trends ⚡ and wider threshold in sideways markets 🌫️.
Trend Calculation (trend_val) 🔄
• Compares price against the previous trend ± adaptive deviation:
○ Price > previous trend + adaptive_dev → trend moves up 🔵
○ Price < previous trend - adaptive_dev → trend moves down 🟠
○ Otherwise → trend stays neutral 🟣
Smoothing ✨
Uses a weighted average to smooth the trend:
trend_smooth = trend_val * smooth_factor + previous_trend_val * (1 - smooth_factor)
• smooth_factor controls responsiveness vs. smoothness.
Trend Coloring 🎨
• Uptrend 🔵, Downtrend 🟠, Neutral 🟣
Plotting 🖌️
• Thin line with diamond steps 💎 for precision.
• Thick semi-transparent line 🌫️ for trend highlighting.
Alerts 🚨
• Triggers uptrend ⬆️ or downtrend ⬇️ alerts in real-time.
Inputs / Settings
Main Settings 🛠️
• ER Length – Bars to calculate Efficiency Ratio (default 100)
• Fast StdDev Length – Fast volatility length (default 50)
• Slow StdDev Length – Slow volatility length (default 200)
• Source – Price source (default close)
• Smoothing Factor – Smoothness control (default 0.5, step 0.05)
Art / Visual Settings 🎨
• Up Trend Color 🔵 – Uptrend color (default blue)
• Down Trend Color 🟠 – Downtrend color (default orange)
• Neutral Trend Color 🟣 – Neutral color (default purple)
Use Cases 💡
• Identify current trend direction and reversals 🔄
• Determine entry & exit points 🎯
• Combine with other indicators (RSI, MACD) for trade confirmation ✅
• Adaptable to volatile ⚡ or sideways 🌫️ markets
In short:
The Adaptive Trend Step is a dynamic trend-following tool 📈 that adjusts automatically to market volatility ⚖️, helping traders spot trends 🔵🟠🟣 without being too noisy during sideways movements 🌊.
Overview
Purpose / Description
The Adaptive Trend Step indicator is designed to track price trends while adapting to market volatility 🌊. It uses adaptive volatility scaling ⚖️ to create a dynamic step-like trend line 📈📉, helping traders identify uptrends 🔵, downtrends 🟠, and neutral phases 🟣. The line adjusts automatically depending on market volatility, making it responsive in fast markets ⚡ and smooth in quiet markets ✨.
How It Works
Efficiency Ratio (ER) ⚡
• Measures the strength of the current price movement relative to recent price changes.
Formula:
ER = (absolute change over 'length') / (sum of absolute changes over 'length')
• ER ranges 0–1, indicating strong trends (closer to 1) or sideways markets (closer to 0).
Adaptive Standard Deviation (Adaptive Dev) 📏
Combines fast and slow standard deviations, weighted by ER:
Adaptive Dev = ER * fast_dev + (1 - ER) * slow_dev
• Creates a tight threshold in strong trends ⚡ and wider threshold in sideways markets 🌫️.
Trend Calculation (trend_val) 🔄
• Compares price against the previous trend ± adaptive deviation:
○ Price > previous trend + adaptive_dev → trend moves up 🔵
○ Price < previous trend - adaptive_dev → trend moves down 🟠
○ Otherwise → trend stays neutral 🟣
Smoothing ✨
Uses a weighted average to smooth the trend:
trend_smooth = trend_val * smooth_factor + previous_trend_val * (1 - smooth_factor)
• smooth_factor controls responsiveness vs. smoothness.
Trend Coloring 🎨
• Uptrend 🔵, Downtrend 🟠, Neutral 🟣
Plotting 🖌️
• Thin line with diamond steps 💎 for precision.
• Thick semi-transparent line 🌫️ for trend highlighting.
Alerts 🚨
• Triggers uptrend ⬆️ or downtrend ⬇️ alerts in real-time.
Inputs / Settings
Main Settings 🛠️
• ER Length – Bars to calculate Efficiency Ratio (default 100)
• Fast StdDev Length – Fast volatility length (default 50)
• Slow StdDev Length – Slow volatility length (default 200)
• Source – Price source (default close)
• Smoothing Factor – Smoothness control (default 0.5, step 0.05)
Art / Visual Settings 🎨
• Up Trend Color 🔵 – Uptrend color (default blue)
• Down Trend Color 🟠 – Downtrend color (default orange)
• Neutral Trend Color 🟣 – Neutral color (default purple)
Use Cases 💡
• Identify current trend direction and reversals 🔄
• Determine entry & exit points 🎯
• Combine with other indicators (RSI, MACD) for trade confirmation ✅
• Adaptable to volatile ⚡ or sideways 🌫️ markets
In short:
The Adaptive Trend Step is a dynamic trend-following tool 📈 that adjusts automatically to market volatility ⚖️, helping traders spot trends 🔵🟠🟣 without being too noisy during sideways movements 🌊.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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.