The main idea of this strategy is based on LazyBear’s Squeeze Momentum indicator to analyze the timing of buying and selling. It analyzes the inflection points in the momentum trend, locating the peaks and troughs as sell and buy signals respectively. As it is a long strategy, it also takes into consideration the 50 period Exponential Moving Average to identify upward trends. If the closing price of the candle is above the 50EMA, and the slope of the 50EMA is trending upwards, then the buy signal is executed.
This strategy incorporates Bollinger Bands and Keltner Channels to identify trends and squeeze zones. Specifically, it calculates a 20-period Bollinger Bands and 20-period Keltner Channels. When Bollinger Bands fall entirely within the Keltner Channels, it is viewed as a squeeze signal. The squeeze zone is identified when the Bollinger Bands lower band goes above the Keltner Channels lower band and the Bollinger Bands upper band goes below the Keltner Channels upper band. Conversely, when the Bollinger Bands lower band falls below the Keltner Channels lower band and the Bollinger Bands upper band rises above the Keltner Channels upper band, it is a non-squeeze zone.
In addition, the strategy utilizes linear regression to analyze the change in momentum slope. It calculates the linear regression value of price over the last 20 periods minus the typical price. When the slope of the linear regression value is positive, it is viewed as an upward trend. When the slope is negative, it is a downward trend. Within the squeeze zone, if there is a reversal in the momentum slope, it signals a buy or sell. Specifically, when within the squeeze zone, a momentum flip from positive to negative issues a sell signal. And when within the squeeze zone, a momentum flip from negative to positive issues a buy signal.
To filter out false signals, the strategy also judges if the closing price is above the 50-day Exponential Moving Average and if the 50-day Exponential Moving Average is in an upward slope. Only when both conditions are met will the buy signal be executed.
This is a very clever strategy, utilizing two different types of indicators to make a multi-dimensional judgment of the market, which can effectively avoid false signals. Specifically, its advantages are:
Comprehensive application of Bollinger Bands, Keltner Channels and momentum indicators for multi-dimensional analysis and improved accuracy.
Squeeze zones can effectively identify peaks and troughs of momentum reversals and precisely capture turns.
Trend filtering based on closing price and 50-day EMA avoids repetitive opening of positions during consolidations.
Signals only emitting during squeeze zones reduces false signals and improves profitability rate.
Large parameter optimization space allows targeted optimizations via adjusting periods etc.
Long and short combined, considers large cycle trends and integrates medium-term indicators, long direction is clear.
Although this strategy has Nonfarmed multiple technical indicators, there are still some risks:
Missing buy/sell opportunities when Bollinger Bands and Keltner Channels diverge.
Large losses may occur during violent market rises or falls.
In high volatility markets, squeeze situations may not be obvious, resulting in fewer signals.
Prone to adjustment losses during bull-bear transitions.
To avoid these risks, we can take the following measures:
Optimize parameters to synchronize Bollinger Bands and Keltner Channels as much as possible.
Set stop loss to control single loss.
Use this strategy as part of a portfolio strategy, combined with other strategies.
Reduce positions appropriately during high volatility markets.
There is still large room for optimizing this strategy, mainly in the following directions:
Optimize periods of Bollinger Bands and Keltner Channels to synchronize them as much as possible.
Test different multiplier factors to find optimal parameter combinations.
Try introducing other indicators for confirmation, such as RSI etc.
Based on Wen Hua Five Color Lines models, selectively utilize this strategy depending on market stages.
Adopt machine learning etc to dynamically optimize parameters.
Backtest on different coins to find the most suitable trading products.
Explore efficacy of this strategy on longer timeframes (daily, weekly etc).
The LazyBear Squeeze Momentum Strategy comprehensively employs various technical indicators, accurately identifying momentum reversals for trading during squeeze zones, avoiding repetitive opening of positions during non-trending markets. It has systematically defined quantifiable buy and sell rules, performing excellently in backtests. Through optimizing parameter settings, introducing new judgment indicators etc, this strategy has large room for improvements and is worth in-depth research and application by quant traders.
/*backtest start: 2023-11-20 00:00:00 end: 2023-12-20 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 // // @author LazyBear // List of all my indicators: https://www.tradingview.com/v/4IneGo8h/ // initialBalance = 8000 strategy("Crypto momentum strategy", overlay=false) length = input(20, title="BB Length") mult = input(2.0, title="BB MultFactor") lengthKC = input(20, title="KC Length") multKC = input(1.5, title="KC MultFactor") useTrueRange = input(true, title="Use TrueRange (KC)", type=input.bool) // Calculate BB source = close basis = sma(source, length) ema = ema(source, 50) dev = multKC * stdev(source, length) upperBB = basis + dev lowerBB = basis - dev // Calculate KC ma = sma(source, lengthKC) range = useTrueRange ? tr : high - low rangema = sma(range, lengthKC) upperKC = ma + rangema * multKC lowerKC = ma - rangema * multKC sqzOn = lowerBB > lowerKC and upperBB < upperKC sqzOff = lowerBB < lowerKC and upperBB > upperKC noSqz = sqzOn == false and sqzOff == false val = linreg(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)), sma(close, lengthKC)), lengthKC, 0) slope = (val - val[2]) emaSlope = (ema - ema[1]) bcolor = iff(slope > 0, color.lime, color.red) scolor = noSqz ? color.green : sqzOn ? color.black : color.green squeeze = (noSqz ? 0 : sqzOn ? 1 : 0) plot(val, color=color.gray, style=plot.style_line, linewidth=1, title="momentum") plot(slope, color=bcolor, style=plot.style_circles, linewidth=2, title="slope") plot(0, color=scolor, style=plot.style_line, linewidth=2, title="squeeze-zero") co = crossover(slope / abs(slope), 0) cu = crossunder(slope / abs(slope), 0) if co and source > ema and emaSlope > 0 strategy.entry("long", strategy.long, comment="long") if cu strategy.close("long")template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6