OPEN-SOURCE SCRIPT

EMA ATR

Updated
Indicator Description: EMA ATR with Signal Logic
This custom indicator, called EMA ATR, combines Exponential Moving Average (EMA) with Average True Range (ATR) to generate buy and sell signals, along with their respective alerts and visual markers.

Key Features:
EMA and ATR Calculation:

EMA (50 Period): The 50-period Exponential Moving Average is calculated and plotted on the chart.
ATR (14 Period): The Average True Range is calculated to determine market volatility and plotted as two offset lines (above and below the EMA).
Buy and Sell Signals:

Buy Signals: Generated when the price is above the EMA and enters the ATR offset above zone, along with certain conditions like the ATR value exceeding a threshold and the candle body not being on the EMA.
Sell Signals: Generated when the price is below the EMA and enters the ATR offset below zone, along with similar conditions.
Signal Logic:

Signals are plotted only if there has been a previous cross of the EMA from the opposite direction (e.g., price must have crossed from below to above the EMA before a buy signal).
Signals are restricted to occur once per trade type (only one buy signal until the next sell signal, and vice versa).
Time-based Restriction: Alerts for signals are only active between 10:00 AM and 4:00 PM GMT+4.
Table Display:

A table displays the current EMA, ATR value, and Stop-Loss (SL) in real time, with customizable background and text colors.
Resetting Signals:

The last signal type (Buy or Sell) is reset every day at 10:00 AM GMT+4, ensuring no stale signals are carried over.
Alert System:

Alerts are generated whenever the price crosses the ATR offset zones (either above or below).
Alerts are also triggered when a Buy or Sell signal is printed during the defined time window (10 AM to 4 PM GMT+4).
Customizable Parameters:

EMA Length: The period for the EMA (default 50).
ATR Length: The period for the ATR calculation (default 14).
Signal and Table Colors: Custom colors for the EMA line, ATR offset lines, table background, and text.
Table Position: The table can be displayed in different positions on the chart (top-right, bottom-left, etc.).
How It Works:
The EMA is plotted on the main chart.
Two lines are drawn above and below the EMA at a distance defined by the ATR.
The indicator monitors price action and, based on conditions such as crossing the EMA and entering the ATR offset zone, prints Buy or Sell signals.
A table on the chart shows real-time values for EMA, ATR, and the calculated Stop-Loss.
Alerts notify you when price crosses ATR offset zones or when Buy/Sell signals occur.
This indicator is ideal for traders looking for a combination of price action and volatility measures to assist in decision-making, while also ensuring that trades are only made within a controlled and time-restricted environment.
Release Notes
### Indicator Description: EMA ATR with Signal Logic

This custom indicator, called **EMA ATR**, combines **Exponential Moving Average (EMA)** with **Average True Range (ATR)** to generate buy and sell signals, along with their respective alerts and visual markers.

#### Key Features:
1. **EMA and ATR Calculation**:
- **EMA (50 Period)**: The 50-period Exponential Moving Average is calculated and plotted on the chart.
- **ATR (14 Period)**: The Average True Range is calculated to determine market volatility and plotted as two offset lines (above and below the EMA).

2. **Buy and Sell Signals**:
- **Buy Signals**: Generated when the price is above the EMA and enters the **ATR offset above** zone, along with certain conditions like the ATR value exceeding a threshold and the candle body not being on the EMA.
- **Sell Signals**: Generated when the price is below the EMA and enters the **ATR offset below** zone, along with similar conditions.

3. **Signal Logic**:
- Signals are plotted only if there has been a **previous cross of the EMA** from the opposite direction (e.g., price must have crossed from below to above the EMA before a buy signal).
- Signals are restricted to occur **once per trade type** (only one buy signal until the next sell signal, and vice versa).
- **Time-based Restriction**: Alerts for signals are only active between **10:00 AM and 4:00 PM GMT+4**.

4. **Table Display**:
- A table displays the current **EMA**, **ATR value**, and **Stop-Loss (SL)** in real time, with customizable background and text colors.

5. **Resetting Signals**:
- The last signal type (Buy or Sell) is reset every day at **10:00 AM GMT+4**, ensuring no stale signals are carried over.

6. **Alert System**:
- Alerts are generated whenever the price crosses the **ATR offset zones** (either above or below).
- Alerts are also triggered when a **Buy** or **Sell** signal is printed during the defined time window (10 AM to 4 PM GMT+4).

7. **Customizable Parameters**:
- **EMA Length**: The period for the EMA (default 50).
- **ATR Length**: The period for the ATR calculation (default 14).
- **Signal and Table Colors**: Custom colors for the EMA line, ATR offset lines, table background, and text.
- **Table Position**: The table can be displayed in different positions on the chart (top-right, bottom-left, etc.).

#### How It Works:
- The EMA is plotted on the main chart.
- Two lines are drawn above and below the EMA at a distance defined by the ATR.
- The indicator monitors price action and, based on conditions such as crossing the EMA and entering the ATR offset zone, prints **Buy** or **Sell** signals.
- A table on the chart shows real-time values for EMA, ATR, and the calculated Stop-Loss.
- Alerts notify you when price crosses ATR offset zones or when Buy/Sell signals occur.

#### TODO:
- Make all parameters customizable
Release Notes
UPDATE
Release Notes
UPDATE
Bands and Channels

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer