This script provides traders with a powerful tool for monitoring interactions with the 50-period Exponential Moving Average (EMA). It offers two key features:
Proximity Alerts: The script detects when the price is approaching the 50 EMA within a customizable proximity threshold (default: 0.1%).
Crossover Alerts: Notifications are triggered when the price crosses the 50 EMA, either from above or below.
Key Features:
50 EMA Calculation: The 50-period Exponential Moving Average is plotted as a blue line for trend analysis.
Dynamic Proximity Detection: Alerts are triggered only when the price dynamically moves into the defined proximity range of the 50 EMA. This prevents constant notifications in choppy conditions.
Visual Highlighting: The chart background turns green when the price enters the proximity zone, making it easy to identify areas of interest visually.
Customizable Threshold: The proximity threshold is set to 0.1% of the EMA value by default but can be adjusted directly in the script for tighter or wider zones.
Two Alert Types:
Proximity Alert: When the price nears the EMA.
Crossover Alert: When the price crosses the EMA.
How It Works:
EMA Calculation: The 50 EMA is calculated using the ta.ema() function in Pine Script.
Proximity Threshold: The script uses a threshold defined as a percentage of the EMA value (0.001 * ema50 by default).
Dynamic Conditions: Alerts are only triggered when the price enters the proximity zone dynamically, avoiding constant signals when the price lingers near the EMA.
Visual Representation: The green background highlights proximity areas, while the alert system notifies you of key events.
Usage Instructions: Add the script to your chart. Adjust the proximity threshold (schwelle) in the script if needed.
Set up alerts in TradingView:
Proximity Alert: Notify when the price is close to the EMA.
Crossover Alert: Notify when the price crosses the EMA.
Use the visual green background as a quick reference for areas of interest.
Ideal For:
Traders who rely on EMA-based strategies for scalping, swing trading, or trend-following.
Those looking for a tool to notify them of key EMA interactions without constant chart monitoring.
Chart Example: The script is designed to work cleanly on any time frame (5m, 15m, 1h, etc.). A sample chart shows: