Type/to search

Dynamic Trend Following Strategy

Cryptocurrency
Created: 2023-12-11 15:43:42
Last modified: 3 years ago
1
Follow
1778
Followers

img

Overview

The main idea of this strategy is to dynamically track market trends by buying when the trend goes up and selling when the trend goes down. It combines multiple technical indicators to determine the trend direction, such as linear regression, modified Hull Moving Average, etc.

Strategy Logic

This strategy utilizes various technical indicators to determine the trend direction. First, it calculates a price channel, with the upper and lower limits based on the simple moving average of close and an input parameter. Then, it calculates the modified Hull Moving Average, which is considered better at depicting trends. In addition, the linear regression indicator is also calculated. It generates buy signals when the modified HMA crosses above the linear regression line, and sell signals when crossing below. This allows dynamically tracking changes in the trend.

To reduce false signals, the strategy also incorporates several filters, such as using EMA to determine if it's in a downtrend, and a windowed indicator to check for RSI divergence. These filters help avoid taking trades during choppy, sideways markets.

For entries and exits, the strategy records the price of the last open position, and sets take profit and stop loss percentages. For example, if the last long entry price is $100, it may set the take profit target at $102, and stop loss price at $95. This achieves dynamic tracking of the trends.

Advantage Analysis

This strategy has the following advantages:

  1. Dynamically tracking trend changes can smoothly catch longer-term directional moves.
  2. Using multiple filters reduces noise and avoids over-trading during choppy markets.
  3. Automatically adjusting stop loss and take profit levels achieves trend following.
  4. Parameters can be optimized through backtesting to find the best combination automatically.

Risk Analysis

There are also some risks with this strategy:

  1. Still cannot completely avoid being caught in trend reversals, which may lead to larger floating losses when trends reverse.
  2. Improper parameter settings may lead to poor strategy performance. Requires optimization to find the best parameters.
  3. Long data processing time may cause signal delays. Need to optimize indicator calculation to be as real-time as possible.

To control risks, one can set stop loss, use trailing stops or options to lock in profits. Also, extensive testing of parameter combinations is necessary to find reliable ranges. Finally, execution time of indicators should be monitored to ensure timely signals.

Optimization Directions

This strategy can be improved in the following aspects:

  1. Test combinations of more indicators to find more reliable ways of determining trends.
  2. Adjust parameter ranges to find optimal parameters.
  3. Optimize signal filters to find balance between noise reduction and lagging.
  4. Try machine learning approaches to automatically generate trading rules.

During optimization, backtesting and paper trading should be utilized extensively to evaluate signal quality and stability. Only well-validated optimizations should be applied in live trading.

Conclusion

Overall this is a decent trend following strategy. It uses multiple indicators to gauge trends, sets up filters to reduce false signals, and can automatically adjust stops and targets to follow trends. With proper parameter tuning, it can smoothly catch mid to long-term trends. Next steps would be finding optimal parameters, and continue validating and improving the strategy.

Source
Pine
/*backtest
start: 2023-12-03 00:00:00
end: 2023-12-06 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RafaelZioni

//@version=4
Strategy parameters
Strategy parameters
Strategy Direction
length of channel
upper percent
lower percent
Fast filter length
Slow filter length
HTF
Timeframe
Period
Shift
len
Min
Exit Profit %
buy Loss Long
rebuy %
filter
risk
leverage
stop loss
qty_percent1
qty_percent2
Take profit1
Take profit2
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)