Type/to search

Adaptive ATR and RSI Trend Following Strategy with Trailing Stop Loss

Common strategy
Created: 2024-01-23 11:31:14
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy combines Average True Range (ATR), Relative Strength Index (RSI) and trailing stop loss to achieve adaptive trend following. Dynamic stop loss is calculated by ATR to reflect market volatility, RSI identifies the trend direction, and trailing stop loss tracks price fluctuation to maximize profit. It is a very typical trend following strategy.

Principles

  1. Calculate ATR. ATR shows market volatility and risk level. This strategy uses ATR to compute dynamic stop loss for adaptive risk control.

  2. Calculate RSI. RSI judges overbought/oversold status. When RSI is above 50 it signals bullish outlook, when below 50 bearish outlook. This strategy utilizes RSI to determine trend direction.

  3. Trailing stop loss tracking. According to stop loss level calculated by ATR and trend direction by RSI, this strategy keeps moving stop loss to track price fluctuation, to maximize profit while ensuring effective stop loss.

  4. Specifically, long when RSI goes above 50, short when goes below 50. Then moving stop loss based on ATR to lock in profit along the trend.

Advantage Analysis

  1. ATR adaptive stop loss considers market volatility, avoids too wide or too tight stop loss.

  2. RSI reliably identifies trend, avoids whipsaws.

  3. Trailing stop loss tracks trend to expand profit target.

Risk Analysis

  1. ATR and RSI parameters need backtest optimization, otherwise impact strategy performance.

  2. Although with stop loss protection, risk still exists for sudden price jump to penetrate stop loss. Can consider position sizing to control risk.

  3. Strategy performance relies much on parameter tuning for different products.

Enhancement

  1. Consider machine learning algorithms for adaptive parameter optimization.

  2. Add position sizing control for dynamic adjustment based on market condition, to reduce stop loss penetration probability.

  3. Add more trend indicators to avoid missing major trend reversal points.

Conclusion

This strategy integrates ATR, RSI and trailing stop loss for a typical adaptive trend following system. Through parameter tuning it can be flexibly adapted to different trading products, a recommended universal trend following strategy. With more judgements and machine learning optimization it can achieve even better performance.

Source
Pine
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-19 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy(title="UTBot Strategy", overlay = true )
   
// CREDITS to @HPotter for the orginal code. 
Strategy parameters
Strategy parameters
BACKTEST START YEAR
BACKTEST START MONTH
BACKTEST START DAY
BACKTEST STOP YEAR
BACKTEST STOP MONTH
BACKTEST STOP DAY
SOURCE
RSI LENGTH
RSI CENTER LINE
MACD FAST LENGTH
MACD SLOW LENGTH
MACD SIGNAL SMOOTHING
Key Vaule. 'This changes the sensitivity'
SmoothK
SmoothD
LengthRSI
LengthStoch
RSISource
ATR Period
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)