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 🌊.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.