OPEN-SOURCE SCRIPT
1H Candlestick vs EMA Crossover

# Description — 1H Candlestick vs EMA Crossover (Pine Script)
This indicator is built in **TradingView Pine Script v5** and is designed to track the relationship between the **1‑hour candlestick close** and the **1‑hour Exponential Moving Average (EMA)**. It works on any chart timeframe but always pulls in **1H data** using `request. security`.
### Core Features
* **Customizable EMA length** (default = 200)
* **Plots the 1H EMA** as an orange line on your chart
* Optionally shows the **1H close** as a faint gray line for reference
* Detects and highlights when the **1H candle close crosses above or below the 1H EMA**
* **Arrows**: Green triangles appear below the bar when a bullish crossover happens (1H close > EMA); red triangles appear above the bar when a bearish crossover happens (1H close < EMA)
* **Alerts**: Built‑in `alert condition` statements let you create TradingView alerts whenever a crossover occurs
### How to Use
1. Adjust the EMA length if you want a faster or slower moving average.
2. Enable alerts: Right‑click the chart → Add Alert → choose this indicator and select either “crossed ABOVE EMA” or “crossed BELOW EMA.”
### Trading Applications
* **Trend Confirmation**: Use the 1H EMA as a higher‑timeframe filter while trading on lower timeframes.
* **Entry/Exit Signals**: Crossovers can mark potential entry points for trend continuation or reversals.
* **Scalping/Intraday**: Even on a 5m or 15m chart, you can overlay the 1H EMA to align your trades with the bigger trend.
This makes the indicator a simple yet powerful tool for aligning trades with higher‑timeframe momentum and avoiding false signals from lower‑timeframe noise.
This indicator is built in **TradingView Pine Script v5** and is designed to track the relationship between the **1‑hour candlestick close** and the **1‑hour Exponential Moving Average (EMA)**. It works on any chart timeframe but always pulls in **1H data** using `request. security`.
### Core Features
* **Customizable EMA length** (default = 200)
* **Plots the 1H EMA** as an orange line on your chart
* Optionally shows the **1H close** as a faint gray line for reference
* Detects and highlights when the **1H candle close crosses above or below the 1H EMA**
* **Arrows**: Green triangles appear below the bar when a bullish crossover happens (1H close > EMA); red triangles appear above the bar when a bearish crossover happens (1H close < EMA)
* **Alerts**: Built‑in `alert condition` statements let you create TradingView alerts whenever a crossover occurs
### How to Use
1. Adjust the EMA length if you want a faster or slower moving average.
2. Enable alerts: Right‑click the chart → Add Alert → choose this indicator and select either “crossed ABOVE EMA” or “crossed BELOW EMA.”
### Trading Applications
* **Trend Confirmation**: Use the 1H EMA as a higher‑timeframe filter while trading on lower timeframes.
* **Entry/Exit Signals**: Crossovers can mark potential entry points for trend continuation or reversals.
* **Scalping/Intraday**: Even on a 5m or 15m chart, you can overlay the 1H EMA to align your trades with the bigger trend.
This makes the indicator a simple yet powerful tool for aligning trades with higher‑timeframe momentum and avoiding false signals from lower‑timeframe noise.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.