OPEN-SOURCE SCRIPT
EMA 200 MultiTF G/R + Cross Alerts by LifeHack Trader

1. Indicator Setup
The script starts by defining the version of Pine Script (v5) and creating an indicator called "EMA 200 MultiTF G/R + Cross Alerts by LifeHack Trader."
The overlay=true parameter ensures that the indicator is plotted directly on the price chart.
2. Function to Get EMA200
A custom function getEma200 is defined to retrieve the 200-period Exponential Moving Average (EMA) for a specified timeframe (tf).
This function uses the request.security function to fetch the close price's EMA from different timeframes.
3. Calculate EMA200 for Multiple Timeframes
The script calculates the EMA200 for four timeframes: 15 minutes ("15"), 1 hour ("60"), 4 hours ("240"), and 1 day ("D").
These values are stored in variables (ema15, ema1h, ema4h, ema1d) and represent the EMA for each timeframe.
4. Determine Price Above or Below EMA200 (G/R)
For each timeframe, the script checks whether the closing price is above or below the EMA200.
It uses boolean checks to determine if the price is above the EMA200, assigning the status "G" (Green) for above and "R" (Red) for below.
5. Cross Signal Detection (Up/Down)
The script detects crossovers and crossunders between the price and EMA200 for each timeframe.
A crossover signal is detected when the price crosses above the EMA200 (bullish), and a crossunder signal is detected when the price crosses below the EMA200 (bearish).
These signals are stored in separate variables (crossUp, crossDown).
6. Display a Table with G/R Status and Cross Alerts
A table is created and displayed in the top-right corner of the chart. The table shows the status (G or R) for each timeframe and the cross signal (▲ for crossover, ▼ for crossunder, or - for no cross event).
The table is updated with the respective values for each timeframe every time a new bar is formed.
7. Alert Conditions
The script defines alert conditions based on the crossovers and crossunders.
When a price crosses above the EMA200 (cross-up), an alert is triggered for a potential buy opportunity. When the price crosses below the EMA200 (cross-down), an alert is triggered for a potential sell opportunity.
Alerts are configured for each timeframe (15 minutes, 1 hour, 4 hours, and 1 day).
This script provides a comprehensive system for monitoring price action relative to the EMA200 on multiple timeframes, highlighting crossovers, and delivering visual feedback and alerts based on the price's relationship with the EMA.
The script starts by defining the version of Pine Script (v5) and creating an indicator called "EMA 200 MultiTF G/R + Cross Alerts by LifeHack Trader."
The overlay=true parameter ensures that the indicator is plotted directly on the price chart.
2. Function to Get EMA200
A custom function getEma200 is defined to retrieve the 200-period Exponential Moving Average (EMA) for a specified timeframe (tf).
This function uses the request.security function to fetch the close price's EMA from different timeframes.
3. Calculate EMA200 for Multiple Timeframes
The script calculates the EMA200 for four timeframes: 15 minutes ("15"), 1 hour ("60"), 4 hours ("240"), and 1 day ("D").
These values are stored in variables (ema15, ema1h, ema4h, ema1d) and represent the EMA for each timeframe.
4. Determine Price Above or Below EMA200 (G/R)
For each timeframe, the script checks whether the closing price is above or below the EMA200.
It uses boolean checks to determine if the price is above the EMA200, assigning the status "G" (Green) for above and "R" (Red) for below.
5. Cross Signal Detection (Up/Down)
The script detects crossovers and crossunders between the price and EMA200 for each timeframe.
A crossover signal is detected when the price crosses above the EMA200 (bullish), and a crossunder signal is detected when the price crosses below the EMA200 (bearish).
These signals are stored in separate variables (crossUp, crossDown).
6. Display a Table with G/R Status and Cross Alerts
A table is created and displayed in the top-right corner of the chart. The table shows the status (G or R) for each timeframe and the cross signal (▲ for crossover, ▼ for crossunder, or - for no cross event).
The table is updated with the respective values for each timeframe every time a new bar is formed.
7. Alert Conditions
The script defines alert conditions based on the crossovers and crossunders.
When a price crosses above the EMA200 (cross-up), an alert is triggered for a potential buy opportunity. When the price crosses below the EMA200 (cross-down), an alert is triggered for a potential sell opportunity.
Alerts are configured for each timeframe (15 minutes, 1 hour, 4 hours, and 1 day).
This script provides a comprehensive system for monitoring price action relative to the EMA200 on multiple timeframes, highlighting crossovers, and delivering visual feedback and alerts based on the price's relationship with the EMA.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
สอนเขียน Bot ส่งคำสั่ง Trade Auto ไป Binance, Bitget
มีห้อง Signal พร้อม Bot ไว้ใช้งาน สำหรับเทรด คริปโต
facebook.com/lifehacktrader/
มีห้อง Signal พร้อม Bot ไว้ใช้งาน สำหรับเทรด คริปโต
facebook.com/lifehacktrader/
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
สอนเขียน Bot ส่งคำสั่ง Trade Auto ไป Binance, Bitget
มีห้อง Signal พร้อม Bot ไว้ใช้งาน สำหรับเทรด คริปโต
facebook.com/lifehacktrader/
มีห้อง Signal พร้อม Bot ไว้ใช้งาน สำหรับเทรด คริปโต
facebook.com/lifehacktrader/
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.