OPEN-SOURCE SCRIPT

EMA + RSI Strategy with Labels for SL and TP

This strategy combines Exponential Moving Averages (EMAs), Relative Strength Index (RSI), and Average True Range (ATR) to create an efficient trading system designed for the 1-hour timeframe. It includes dynamic stop-loss and optional take-profit levels for risk management.

Key Components
1. Indicators Used
Exponential Moving Averages (EMAs):

Short EMA (default 9-period): Tracks recent price trends.
Long EMA (default 21-period): Tracks longer-term trends.
Condition: A bullish trend is identified when the Short EMA is above the Long EMA, and a bearish trend is identified when the Short EMA is below the Long EMA.
Relative Strength Index (RSI):

Measures momentum and identifies overbought/oversold conditions.
Default Settings:
Overbought Level: 70
Oversold Level: 30
Condition:
Long trades are triggered when the RSI crosses above the oversold level (30).
Short trades are triggered when the RSI crosses below the overbought level (70).
Average True Range (ATR):

Measures market volatility.
Used to dynamically calculate stop-loss and take-profit levels.
Entry Rules
Long Entry:

RSI crosses above the oversold level (30).
Short EMA is above the Long EMA (bullish trend).
A buy signal is plotted on the chart.
Short Entry:

RSI crosses below the overbought level (70).
Short EMA is below the Long EMA (bearish trend).
A sell signal is plotted on the chart.
Exit Rules
Dynamic Stop Loss:

Calculated as 1.5x ATR from the entry price.
Adjusts based on market volatility to prevent premature exits.
Optional Take Profit:

Calculated as 2x ATR from the entry price (configurable).
Can be enabled or disabled in the settings.
Automatic Exit:

If the price hits the stop-loss or take-profit levels, the position is exited.
Features
Dynamic Risk Management:

ATR-based stop-loss ensures that risk adapts to market volatility.
Reduces losses during highly volatile periods.
Take-Profit Flexibility:

Take profit can be toggled on or off.
The default multiplier is 2x ATR, which provides a balance between risk and reward.
Signal Visualizations:

Clear buy/sell signals are plotted on the chart using labels.
Stop-loss and take-profit levels are displayed as dynamic lines.
Labels for SL (Stop Loss) and TP (Take Profit) appear at entry to provide quick reference points.
Trend and Momentum Filtering:

EMAs ensure trades align with the prevailing trend.
RSI ensures entries occur during momentum shifts.
Strengths of This Strategy
Trend-Following: Ensures trades are made in the direction of the prevailing market trend.
Momentum-Based Entries: RSI adds precision to the entry points, capturing reversals in momentum.
Volatility Protection: ATR-based stop-loss prevents exiting trades too early during volatile market conditions.
Scalability: Works effectively on the 1-hour timeframe but can be tested on other timeframes with appropriate adjustments.
Best Use Cases
Intraday Trading: Ideal for 1-hour timeframe trading with minimal monitoring.
Volatile Markets: Adapts well to markets with varying volatility, thanks to ATR-based calculations.
Forex, Stocks, or Cryptos: Versatile strategy that can be applied across different asset classes.
Customization Options
Adjust EMA lengths for faster or slower trend detection.
Change RSI levels to suit different asset classes or trading styles.
Fine-tune ATR multipliers to balance stop-loss and take-profit distances.
Average True Range (ATR)Exponential Moving Average (EMA)Relative Strength Index (RSI)

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?

免責事項