OPEN-SOURCE SCRIPT
تم تحديثه BB Live Alert Engine (Clean Cycle Logic)

This script gives real-time entry and exit alerts for scalping trades in GC & SI
ملاحظات الأخبار
Cleaner entry exit symbols and alertsملاحظات الأخبار
Bollinger Band Live Alert Engine (Mean Reversion Alerts)Most Bollinger Band strategies look great on charts — but they are difficult to monitor in real time.
This script solves that problem by providing fully automated alerts for Bollinger Band mean-reversion setups, allowing traders to receive signals instantly without constantly watching the chart.
The indicator detects band breaches, averaging opportunities, and mean-reversion exits, making it ideal for traders who execute trades manually but want reliable alerting.
Key Features
✔ Real-time entry alerts when price breaches Bollinger Bands
✔ Automatic averaging signals when price continues extending
✔ Exit alerts when price reverts to the middle band
✔ Clean visual markers for entries and exits
✔ Designed specifically for live trading alerts
✔ Prevents duplicate alerts and alert spam
✔ Works well in volatile markets
Strategy Overview
The script uses Bollinger Bands (21, 2.1) and follows a classic mean reversion approach.
When price moves too far from the average, the system looks for a reversion back toward the middle band.
Only one trade cycle is active at a time, ensuring signals remain clear and structured.
Entry Conditions
Long Entry
A long signal occurs when:
• The low of a candle breaks below the lower Bollinger Band
The candle does not need to close below the band.
The signal triggers as soon as the band is breached.
Short Entry
A short signal occurs when:
• The high of a candle breaks above the upper Bollinger Band
Again, the candle does not need to close above the band.
Averaging Signals
If price continues extending after entry, the script generates averaging signals.
Long Averaging
Occurs when:
• A subsequent candle closes below the lower Bollinger Band
Short Averaging
Occurs when:
• A subsequent candle closes above the upper Bollinger Band
Averaging signals are only generated after the candle closes, preventing intrabar noise.
Exit Conditions
All positions close when price reverts to the middle Bollinger Band.
Long Exit
Triggered when:
• The high of a candle touches or crosses the middle band
Short Exit
Triggered when:
• The low of a candle touches or crosses the middle band
This allows traders to capture the mean reversion move back to the average.
Visual Signals
The indicator uses minimal markers to keep the chart clean:
▲ Green Triangle → Long entry or averaging
▼ Red Triangle → Short entry or averaging
✕ Orange Cross → Trade exit at the middle band
Alerts
The script automatically generates alerts for:
• OPEN LONG
• OPEN SHORT
• AVERAGE LONG
• AVERAGE SHORT
• CLOSE LONG
• CLOSE SHORT
To enable alerts:
Create a TradingView alert and select:
Condition → Any alert() function call
The script will handle all alert logic internally.
Recommended Setup
This script works best when combined with the standard TradingView Bollinger Band indicator for visual reference.
Recommended timeframe: 5 minutes (but can be used on others).
Ideal Markets
This indicator works particularly well on liquid instruments that exhibit mean-reverting behavior, such as:
• Gold Futures
• Silver Futures
• Index futures
• High-liquidity forex pairs
Why This Script Exists
Many traders use Bollinger Bands for mean-reversion strategies, but manually watching charts for band breaches and exits can be exhausting.
This script was created to provide reliable, structured alerts so traders can focus on execution rather than constant chart monitoring.
Open Source
This script is open-source so traders can study, modify, and improve it.
If you find it useful, consider boosting the script so more traders can discover it.
Disclaimer
This script is provided for educational purposes only and should not be considered financial advice. Always test and manage risk appropriately.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.