Tags:

The Bandpass Filtering Trend Extraction Strategy is a stock trend tracking strategy based on bandpass filters. It uses an exponentially weighted moving average and bandpass filtering to process the price series and extract the trend component in prices as the signal for entries and exits.

The strategy first constructs a double exponential moving average by tuning the Length and Delta parameters to control the length of the moving average and smoothness. Then it uses a set of mathematical transformations to extract the trend component from the price series and stores it in the xBandpassFilter variable. Finally, it calculates the simple moving average of xBandpassFilter, xMean, as the indicator for entries and exits.

It goes long when xMean crosses above the Trigger level, and goes short when crossing below. The sensitivity of entries and exits can be controlled by tuning the Trigger level.

- The double EMA effectively filters out some noise in prices for more stable strategies.
- Bandpass filtering only extracts the trend component in prices, avoiding whipsaws.
- Fewer parameters make optimization and risk control easier.

- Time lag causes missed opportunities from quick reversals.
- Double EMA and bandpass filtering have low pass effects, reducing sensitivity.
- Overfiltering can cause missing strong trends if parameters poorly tuned.

Shortening Length can improve lag issues. Tuning Trigger controls sensitivity.

- Add stop loss to control single trade loss.
- Dual moving averages system can improve stability.
- Combine with volume or other reversal signals to avoid whipsaws.
- Use machine learning or genetic algorithms to optimize parameters.

The strategy is relatively stable with good performance in strong trending markets. Further optimizations in multiple market environments can make it more reliably profitable. It warrants further research and application.

/*backtest start: 2022-12-27 00:00:00 end: 2024-01-02 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version = 2 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 14/12/2016 // The related article is copyrighted material from Stocks & Commodities Mar 2010 // // You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect... // You can change long to short in the Input Settings // Please, use it only for learning or paper trading. Do not for real trading. //////////////////////////////////////////////////////////// strategy(title="Extracting The Trend Strategy Backtest") Length = input(20, minval=1) Delta = input(0.5) Trigger = input(0) reverse = input(false, title="Trade reverse") hline(Trigger, color=blue, linestyle=line) xPrice = hl2 beta = cos(3.1415 * (360 / Length) / 180) gamma = 1 / cos(3.1415 * (720 * Delta / Length) / 180) alpha = gamma - sqrt(gamma * gamma - 1) xBandpassFilter = 0.5 * (1 - alpha) * (xPrice - xPrice[2]) + beta * (1 + alpha) * nz(xBandpassFilter[1]) - alpha * nz(xBandpassFilter[2]) xMean = sma(xBandpassFilter, 2 * Length) pos = iff(xMean > Trigger, 1, iff(xMean < Trigger, -1, nz(pos[1], 0))) possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos)) if (possig == 1) strategy.entry("Long", strategy.long) if (possig == -1) strategy.entry("Short", strategy.short) barcolor(possig == -1 ? red: possig == 1 ? green : blue ) plot(xMean, color=red, title="ExTrend")

- Bollinger Bands Breakout Swing Trading Strategy
- Trend Tracking Reversal Strategy
- AlexInc's Bar v1.2 Breakout Accumulation Strategy Based on Meaningful Bar Filtering
- Stock Quant Trading Strategy Combining Exponential Moving Average with Trailing Stop Loss and Percentage Stop Loss
- Moving Average Crossover System
- Close Buying Next Open Profit Taking Strategy
- Moving Stop Loss Tracking Strategy
- Short-term Trend Tracking Strategy Based on Gann Me Analysis Indicator
- The Gaussian Moving Average Trading Strategy
- Adaptive Kaufman Moving Average Trend Following Strategy
- Dual Reversal High-Low Strategy
- Heyping Moving Average Trend Strategy
- Long and Short Opening Strategy Based on Multi Timeframe Moving Average and MACD
- Momentum Indicator RSI Reversal Trading Strategy
- Double Bollinger Band Breakout Strategy
- Automatic Tracking Trend Strategy Based on T3 and ATR
- ATR Channel Breakout Trend-following Strategy
- MACD 200 Day Moving Average Crossover Trading Strategy
- Golden Cross Uptrend Tracking Strategy
- Dual EMA Crossover Oscillation Tracking Strategy