OPEN-SOURCE SCRIPT

EMA Trend & Trigger Strategy

131
This Pine Script strategy, titled "EMA Trend & Trigger Strategy," is designed to trade based on the interaction of Exponential Moving Averages (EMAs) on two timeframes: 1D (daily) and 1H (hourly). Here's a summary of how it works:

Key Components:
EMA Lengths:

1D (Daily): Short EMA with a period of 5, and long EMA with a period of 30.
1H (Hourly): Short EMA with a period of 12, and long EMA with a period of 26.
Trend Identification (1D):

The trend is considered uptrend when the short EMA is above the long EMA, and downtrend when the short EMA is below the long EMA.
Trade Triggers (1H):

Buy Signal: A buy signal is triggered when the short EMA crosses above the long EMA on the 1H chart and the trend is up (based on the 1D EMAs).
Sell Signal: A sell signal is triggered when the short EMA crosses below the long EMA on the 1H chart and the trend is down (based on the 1D EMAs).
Volatility-based Triggers:

The strategy looks for high volatility (price change of more than 5%) during uptrend or downtrend to trigger buy or sell actions, respectively.
Stop Loss Calculation:

Local Bottom: The lowest point in the last 10 bars is used as the stop for long positions.
Local Peak: The highest point in the last 10 bars is used as the stop for short positions.
Execution:

Long Entry: Executed when there is a buy signal or high volatility during an uptrend.
Short Entry: Executed when there is a sell signal or high volatility during a downtrend.
The positions are exited when the price reaches the respective local bottom or peak.
Plotting:

The script plots the 1D short and long EMAs in blue and red, and the 1H short and long EMAs in green and orange on the chart.
In summary, this strategy combines trend-following with EMA crossovers, volatility filtering, and dynamic stop loss calculation to manage entries and exits for both long and short positions.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.