OPEN-SOURCE SCRIPT

"50 EMA Proximity & Crossover Alert"

This script provides traders with a powerful tool for monitoring interactions with the 50-period Exponential Moving Average (EMA). It offers two key features:

  1. Proximity Alerts: The script detects when the price is approaching the 50 EMA within a customizable proximity threshold (default: 0.1%).
  2. 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:
  1. Proximity Alert: Notify when the price is close to the EMA.
  2. Crossover Alert: Notify when the price crosses the EMA.
  3. 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:
  • The 50 EMA as a blue line.
  • A green background indicating proximity zones.
  • Alerts set for proximity and crossover.
forecastingMoving AveragesTrend Analysis

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?

免責事項