OPEN-SOURCE SCRIPT
Updated

RoGr75 - EMA Cross Signal with Buffer and Variable Distance

**Overview**:
This script is designed to identify potential buy and sell signals based on the crossover of two Exponential Moving Averages (EMAs) – a short-term EMA (default: 8 periods) and a long-term EMA (default: 50 periods). To reduce noise and false signals, the script incorporates a customizable buffer percentage, ensuring that signals are only generated when the short-term EMA moves significantly above or below the long-term EMA. Additionally, the script allows users to adjust the distance of the signals from the candles using the Average True Range (ATR) for better visualization.

---
Improvements: Added Buffer Percentage for reduced noise in Signals

### **Key Features**:
1. **EMA Crossover Signals**:
Buy Signal: Generated when the short-term EMA crosses above the long-term EMA.
Sell Signal: Generated when the short-term EMA crosses below the long-term EMA.

2. **Buffer Percentage**:
A user-defined buffer percentage ensures that signals are only triggered when the short-term EMA moves a specified percentage above or below the long-term EMA, reducing false signals.

3. **Customizable Signal Distance**:
Signals are plotted at a user-defined distance from the candles, calculated using the ATR (Average True Range) for dynamic positioning.

4. **Visual Enhancements**:
Buy and sell signals are displayed as labels above or below the candles, with optional background highlighting for better visibility.

5. **Flexible Inputs**:
Users can customize the lengths of the short-term and long-term EMAs, the ATR period, the signal distance multiplier, and the buffer percentage.

6. **Alerts**:
Built-in alert conditions allow users to receive real-time notifications for buy and sell signals.

### **Input Parameters**:
**Short EMA Length**: Period for the short-term EMA (default: 8).
**Long EMA Length**: Period for the long-term EMA (default: 50).
**Signal Distance**: Multiplier for ATR to determine the distance of signals from the candles (default: 2.0).
**ATR Length**: Period for the ATR calculation (default: 14).
**Buffer Percentage**: Percentage buffer for reversal signals to reduce noise (default: 1.0%).

### **Ideal For**:
Traders who use EMA crossovers as part of their strategy.
Those looking to reduce false signals with a buffer mechanism.
Users who prefer dynamic signal positioning based on market volatility (ATR).

### **Notes**:
The buffer percentage ensures that signals are only generated when the price moves significantly, making it suitable for trend-following strategies.
The script is highly customizable, allowing traders to adapt it to different timeframes and instruments.
Release Notes
### **Indicator Description: RoGr75 - EMA Cross Signal with Buffer and Variable Distance v.1.1**

This TradingView indicator, "RoGr75 - EMA Cross Signal with Buffer and Variable Distance v.1.1," is designed to generate buy and sell signals based on the crossover of two Exponential Moving Averages (EMAs) with an added buffer for more robust signal generation. The indicator incorporates features such as adjustable signal distance, Average True Range (ATR)-based positioning, background highlighting, and customizable alerts. Below is a detailed explanation of its functionality, features, and important warnings.

---

#### **Key Features**
1. **Dual EMAs**:
- The indicator calculates two EMAs: a short-term EMA (`ema_short`) and a long-term EMA (`ema_long`).
- Signals are generated when these EMAs cross over or under each other.

2. **Adaptive Buffer**:
- A buffer distance is dynamically calculated as a percentage of the `ema_long`. This adds a margin to the crossover conditions, reducing false signals caused by minor price fluctuations.

3. **Signal Positioning**:
- Buy and sell labels are positioned relative to the candles using the Average True Range (ATR) value for better visibility.
- The distance of the signals from the candles can be adjusted via the `signal_distance` input.

4. **Background Highlighting**:
- The background is highlighted in green for buy signals and red for sell signals, with adjustable transparency.

5. **Alerts**:
- Alerts are set up for both buy and sell signals, allowing traders to receive notifications in real-time.

6. **Customizable Appearance**:
- Users can customize the colors, label styles, and transparency to suit their preferences.

---

#### **How It Works**
1. **Buy Signal**:
- A buy signal is triggered when the `ema_short` crosses above the `ema_long + buffer_distance`.

2. **Sell Signal**:
- A sell signal is triggered when the `ema_short` crosses below the `ema_long - buffer_distance`.

3. **Signal Confirmation**:
- The buffer ensures that signals are only generated when there is a significant movement between the two EMAs, reducing the likelihood of whipsaws.

---

#### **Inputs**
The following inputs can be customized in the settings panel:

- **Signal Distance from Candles**: Controls how far the signal labels are placed from the candles.
- **ATR Length**: Determines the period for calculating the Average True Range (ATR), which influences the vertical placement of the signals.
- **Short EMA Length**: Length of the short-term EMA.
- **Long EMA Length**: Length of the long-term EMA.
- **Buffer Percentage for Reversal**: Adds a buffer to the crossover condition to reduce false signals. This value is expressed as a percentage of the `ema_long`.

---

#### **Warnings**
1. **False Signals**:
- While the buffer helps reduce false signals, no indicator is perfect. Use this indicator in conjunction with other tools for confirmation.

2. **Lagging Nature of EMAs**:
- EMAs are lagging indicators, meaning they may not capture sudden price movements quickly. Be cautious during volatile markets.

3. **Buffer Sensitivity**:
- The buffer percentage must be carefully adjusted. Setting it too high may delay signals, while setting it too low may increase the risk of false signals.

4. **ATR-Based Positioning**:
- The ATR-based positioning of signals may vary depending on market volatility. Adjust the `signal_distance` parameter to ensure optimal visibility.

5. **Backtesting Required**:
- Always backtest this indicator on historical data to evaluate its performance before using it in live trading.

6. **Not Financial Advice**:
- This indicator is a tool and should not be considered financial advice. Traders are responsible for their own decisions.

---

#### **Usage Tips**
- Combine this indicator with other technical analysis tools, such as RSI, MACD, or support/resistance levels, for better accuracy.
- Adjust the input parameters to fit your trading style and the market you are analyzing.
- Use the alerts feature to stay informed about potential trade opportunities without constantly monitoring the chart.
- Experiment with different buffer percentages and EMA lengths to find the best settings for your strategy.

Disclaimer