Type/to search

RSI Trend Following Strategy with Trailing Stop Loss

Cryptocurrency
Created: 2023-12-08 11:41:31
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

This strategy is an automated trading strategy that identifies trend using the RSI indicator and confirms the trend with moving averages, with stop loss and take profit settings. It goes long when RSI goes above 68 and the current moving average crosses above the previous moving average, and goes short when RSI drops below 28 and the current moving average crosses below the previous moving average. Stop loss and take profit points are also configured.

Strategy Logic

The strategy mainly uses the RSI indicator to identify overbought and oversold conditions to determine the trend. Values above 70 for RSI indicate an overbought condition and values below 30 indicate an oversold condition. The trend is confirmed using the golden cross and death cross signals from the moving averages. The specific trading signals are:

Long signal: RSI goes above 68 and current moving average crosses above previous moving average, go long.
Short signal: RSI goes below 28 and current moving average crosses below previous moving average, go short.

The stop loss and take profit settings are staggered, from more loose to more strict:

Long take profit: Take profit 50% of position at 1.4% above the high, take profit 100% at 0.8% above the high.
Long stop loss: Set stop loss at 2% below the entry price.

Short take profit: Take profit 50% of position at 0.4% below the low, take profit 100% at 0.8% below the low.
Short stop loss: Set stop loss at 2% above the entry price.

Also, when trend reverses, like RSI breaking below 30 when long, close entire long position at market; when RSI breaks above 60 when short, close entire short position at market.

Advantages

  1. Use RSI to determine overbought/oversold to avoid buying high and selling low.
  2. Filters with moving averages to reduce trades against the major trend.
  3. Staggered take profit targets to maximize profits.
  4. Wider stop loss allows for some retracement.
  5. Trend reversal based position closing reacts fast to sudden events.

Risks

  1. Poor RSI parameter tuning leading to inaccurate signals.
  2. Poor moving average parameter tuning leading to weak filtering.
  3. Stop loss too wide leading to large losses.
  4. Take profit too tight leaving profits on the table.
  5. Inaccurate reversal signal closing positions unnecessarily.

To address the above risks, extensive parameter tuning should be done. Stop loss and take profit should also be set appropriately based on market volatility. Reversal signals should be used carefully to avoid unnecessary losses.

Enhancement Opportunities

The strategy can be further improved:

  1. Add more filters like volume to improve signal accuracy.
  2. Implement trailing stop loss to lock in profits.
  3. Use trailing take profit for some exits to maximize profits.
  4. Add instrument switching for using optimal parameters.
  5. Incorporate cost of carry for futures to dynamically adjust stops.

Conclusion

Overall this is a mature and reliable trend following strategy. It identifies trend well using RSI and further filters with moving averages. It also implements sensible stop loss and staggered take profit settings. It can perform very well in trending markets if tuned appropriately. Further optimizations can lead to even better performance.

Source
Pine
// © CRabbit
//@version=5

// Starting with $100 and using 10% of the account per trade
strategy("RSI Template", shorttitle="RSI", overlay=false, initial_capital=100, default_qty_value=10, default_qty_type=strategy.percent_of_equity)

// RSI Indicator
ma(source, length, type) =>
    switch type
        "SMA" => ta.sma(source, length)
        "Bollinger Bands" => ta.sma(source, length)
        "EMA" => ta.ema(source, length)
Strategy parameters
Strategy parameters
Start Date
Start Month
Start Year
Return Precision
RSI Settings
RSI Length
Source
MA Settings
MA Type
MA Length
BB StdDev
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)