Type/to search

Quantitative Trading Strategy Based on Double Trend Filter

Common strategy
Created: 2023-12-26 12:18:54
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This is a quantitative trading strategy that utilizes double trend filters. The strategy combines both global trend filter and local trend filter to ensure entering positions only when the trend direction is correct. In addition, the strategy sets multiple other filters such as RSI filter, price filter, slope filter etc. to further improve reliability of trading signals. On the exit side, the strategy presets stop loss price and take profit price. Overall, this is a stable and precise quantitative trading strategy.

Strategy Logic

The core logic of this strategy is based on the double trend filters. The global trend filter judges overall market trend based on high-period EMA, while the local trend filter judges local trend based on low-period EMA. Only when both filters suggest the same trend direction, the strategy will enter positions.

Specifically, the strategy calculates BTCUSDT's EMA to determine if the overall market is in an upward or downward trend. This is the global trend filter. At the same time, the strategy calculates EMA of the underlying contract to determine local trend. This is the local trend filter. Only when both filters agree on the same trend direction, combined with other auxiliary filters, the strategy will generate trading signals and preset stop loss and take profit prices for entering positions.

Once determining a tradable signal, the strategy will immediately place orders to enter positions. Meanwhile, stop loss price and take profit price are preset. When price touches either of them, the strategy will automatically exit positions with stop loss or take profit.

Advantage Analysis

This is a stable and reliable quantitative trading strategy with the following main advantages:

  1. Adopting double trend filtering mechanism to filter out most false signals and make trading signals more reliable.

  2. Combining multiple auxiliary filters like RSI filter and price filter to further improve signal quality.

  3. Automatically calculating stop loss and take profit price to lower trading risks without manual monitoring.

  4. Customizable strategy parameters to adapt more trading instruments with better adaptability.

  5. Clear strategy logic easy to understand, and with greater potential for optimization.

Risk Analysis

Although with many advantages, there are still some trading risks mainly in:

  1. Double trend filters may fail to determine accurate entry timing. Parameters can be optimized.

  2. Inaccurate stop loss and take profit price setting may lead to premature exit. Different parameter sets can be tested to find optimum.

  3. Improper selection of trading instruments and timeframes may make the strategy ineffective. Parameter optimization and testing are suggested separately for different trading instruments.

  4. There are some overfitting risks. More backtests in diverse market environments are needed to ensure robustness.

Optimization Directions

The main directions for optimizing this strategy include:

  1. Adjust parameters of double filters to find optimum combination.

  2. Test and select the best auxiliary filters.

  3. Optimize the stop loss and take profit algorithms to make them more intelligent.

  4. Try introducing machine learning models for dynamic parameter tuning.

  5. More backtests on more instruments and longer time spans to improve stability.

Conclusion

In conclusion, this is an overall stable, accurate and easily optimizable quantitative trading strategy. It produces trading signals by combining double trend filters and multiple auxiliary filters, filtering out most noise and generating more reliable signals. Also, the inbuilt stop loss and take profit presetting helps lower trading risks. This is a strategy with great practical value. After optimization and validation, it can be directly applied for live trading. Moreover, it has huge potential for expansions and is worth in-depth researching.

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


//@version=4

strategy(title = 'Cipher_B', overlay=true )
Strategy parameters
Strategy parameters
Show WaveTrend
Show Buy dots
Show Gold dots
Show Sell dots
Show Div. dots
Show Fast WT
WT Channel Length
WT Average Length
WT MA Source
WT MA Length
WT Overbought Level 1
WT Overbought Level 2
WT Overbought Level 3
WT Oversold Level 1
WT Oversold Level 2
WT Oversold Level 3
Show WT Regular Divergences
Show WT Hidden Divergences
Not apply OB/OS Limits on Hidden Divergences
WT Bearish Divergence min
WT Bullish Divergence min
Show 2nd WT Regular Divergences
WT 2nd Bearish Divergence
WT 2nd Bullish Divergence 15 min
Show MFI
MFI Period
MFI Area multiplier
MFI Area Y Pos
Show RSI
RSI Source
RSI Length
RSI Oversold
RSI Overbought
Show RSI Regular Divergences
Show RSI Hidden Divergences
RSI Bearish Divergence min
RSI Bullish Divergence min
Show Stochastic RSI
Use Log?
Use Average of both K & D
Stochastic RSI Source
Stochastic RSI Length
RSI Length
Stochastic RSI K Smooth
Stochastic RSI D Smooth
Show Stoch Regular Divergences
Show Stoch Hidden Divergences
Show Schaff TC line
Schaff TC Source
Schaff TC
Schaff TC Fast Lenght
Schaff TC Slow Length
Schaff TC Factor
Show Sommi flag
Show Sommi F. Wave
Sommi F. Wave timeframe
F. Wave Bear Level (less than)
F. Wave Bull Level (more than)
WT Bear Level (more than)
WT Bull Level (less than)
Money flow Bear Level (less than)
Money flow Bull Level (more than)
Show Sommi diamond
HTF Candle Res. 1
HTF Candle Res. 2
WT Bear Level (More than)
WT Bull Level (Less than)
Show MACD Colors
MACD Colors MACD TF
Dark mode
Trend Settings
Use Global trend?
Global trend timeframe
Global trend length
Local trend filter length
Local trend filter timeframe
Only divergencies for long
Only divergencies for short
Sommi diamond alerts
Cancel all positions if price crosses local sma? (yellow line)
RSI filter ON
Price filter ON
Long Price filter from
Long Price filter to
Short Price filter from
Short Price filter to
Use Local trend?
TP/SL Settings
TP long
TP long div
TP short
SL long
SL short
Slope Settings
Use Slope filter?
Slope number long
Slope number short
Slope period
Position Settings
Only long?
Only short?
Volume Settings
Volume filter?
Volume no more than:
Volume no less than:
Shift Settings
Shift open position?
How many % to shift?
Cancel Settings
Cancel position in #bars?
Number of bars
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)