This strategy combines three different technical indicators and generates trading signals using a dual moving average system, with additional filters based on the color and body of candlesticks, to construct a relatively stable and effective short-term trading strategy.
The strategy uses Bollinger Bands and KC channels in combination to identify compression and expansion phases in the market. Specifically, when Bollinger Bands are within the KC channel, it is considered compression; when Bollinger Bands break through the KC channel, it is considered expansion. Compression represents intensified volatility and possible trend reversal, and linear regression is used as the primary trading signal indicator at this time.
If the linear regression histogram is positive (representing an upward trend) and the bar is a red candlestick (representing a close lower), at the same time the candlestick body is larger than 1/3 of the average body of the past 30 candlesticks, such a combination signal goes long. Conversely, if the linear regression histogram is negative, the bar is a green candlestick, and the body is also large, it goes short.
The strategy also provides a visualization of the compression and expansion background to assist in judging the market stage.
Risks can be reduced by adjusting indicator parameters, optimizing filtering criteria, etc.
The strategy can be optimized in the following aspects:
This strategy combines multiple indicators, while identifying compression opportunities, it increases filtering conditions to form a relatively robust efficient short-term strategy. Through parameter and filtering condition optimization, better results can be obtained. In addition, the strategy framework is flexible and easy to adjust for use in different varieties, worth further testing and optimization.
/*backtest start: 2023-11-24 00:00:00 end: 2023-12-24 00:00:00 period: 2h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //Noro //2017 //@version=2 strategy(shorttitle = "Squeeze str 1.0", title="Noro's Squeeze Momentum Strategy v1.0", overlay = false, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0) //Settings needlong = input(true, defval = true, title = "Long") needshort = input(true, defval = true, title = "Short") 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 = true usecolor = input(true, defval = true, title = "Use color of candle") usebody = input(true, defval = true, title = "Use EMA Body") needbg = input(false, defval = false, title = "Show trend background") fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year") toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year") frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month") tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month") fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day") today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day") // Calculate BB source = close basis = sma(source, length) 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) bcolor = iff( val > 0, iff( val > nz(val[1]), lime, green), iff( val < nz(val[1]), red, maroon)) scolor = noSqz ? blue : sqzOn ? black : gray trend = val > 0 ? 1 : val < 0 ? -1 : 0 //Background col = needbg == false ? na : trend == 1 ? lime : red bgcolor(col, transp = 80) //EMA Body body = abs(close - open) emabody = ema(body, 30) / 3 //Signals bar = close > open ? 1 : close < open ? -1 : 0 up = trend == 1 and (bar == -1 or usecolor == false) and (body > emabody or usebody == false) dn = trend == -1 and (bar == 1 or usecolor == false) and (body > emabody or usebody == false) if up strategy.entry("Long", strategy.long) if dn strategy.entry("Short", strategy.short)