Price Reversal Strategy Guided by Price Channel

Author: ChaoZhang, Date: 2023-11-27 11:40:36
Tags:

img

Overview

The price reversal strategy guided by price channel calculates the center line of the price channel to determine the trend direction of price fluctuations. It generates long and short signals when the price approaches the channel center line. This strategy combines multiple filter conditions to search for high probability trading opportunities.

Strategy Logic

The core indicator of this strategy is the price channel center line. It is calculated as the average of the highest price and lowest price of the most recent 30 candlesticks. When the low is higher than the center line, it is considered an uptrend. When the high is lower than the center line, it is considered a downtrend.

The strategy only generates trading signals when the trend background changes. That is, in an uptrend background, it goes short only when the candlestick turns red. In a downtrend background, it goes long only when the candlestick turns green.

In addition, the strategy also sets double filter conditions: candlestick body filter and price channel bars filter. Signals are triggered only when the candlestick body volume is greater than 20% of the average value, and there must be consecutive trend signals within the filter cycle to open positions.

Advantage Analysis

This strategy combines trend, value area and candlestick patterns, which is an efficient reversal trading strategy. The main advantages are:

  1. Using the price channel to determine the major trend and avoid being misled by range-bound markets.
  2. Selecting price levels near the price channel center line, which is the classic low-buy-high-sell area.
  3. Candlestick body and channel bars filters increase signal quality and reduce false signal rates.
  4. Open positions only at obvious reversal points to avoid chasing highs and selling lows.

Risks and Solutions

The main risks of this strategy come from missing price reversal points and unnecessary waiting for signals. It can be optimized in the following ways:

  1. Adjust the strictness of filter conditions and reduce filtering standards to decrease missing trades.
  2. Increase position size in the early stage of reversal trend to capture trend profits.
  3. Combine other indicators to judge the signal strength and intervene in filters manually.

Optimization Directions

This strategy can be optimized in the following aspects:

  1. Optimize parameters like the price channel period, number of channel bars etc.
  2. Add stop loss strategy to stop loss when loss reaches a certain percentage.
  3. Combine trading volume to intervene in filter strength. For example, relax filters when trading volume amplifies.
  4. Add machine learning model to judge probability of trend reversal, replacing simple filters.

Conclusion

The price reversal strategy guided by the price channel determines reversal points through price channels, and sets double filter conditions to generate high quality signals. On the basis of parameter tuning and risk control, it is a reliable quantitative strategy.


/*backtest
start: 2023-11-19 00:00:00
end: 2023-11-26 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's PriceChannel for D1 v1.0", shorttitle = "PriceChannel D1", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 0)

//Settings
needlong = input(true, "long")
needshort = input(true, "short")
slowlen = input(30, defval = 30, minval = 2, maxval = 200, title = "PriceChannel Period")
pcbars = input(1, defval = 1, minval = 1, maxval = 20, title = "PriceChannel Bars")
usecol = input(true, "Use color-filter")
usebod = input(true, "Use body-filter")
needbg = input(false, defval = false, title = "Need 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")

src = close

//PriceChannel
lasthigh = highest(src, slowlen)
lastlow = lowest(src, slowlen)
center = (lasthigh + lastlow) / 2

//Trend
ub = low > center ? 1 : 0
db = high < center ? 1 : 0
trend = sma(ub, pcbars) == 1 ? 1 : sma(db, pcbars) == 1 ? -1 : trend[1]

//Body
body = abs(close - open)
abody = sma(body, 10)

//Signals
up = trend == 1 and (close < open or usecol == false) and (body > abody / 5 or usebod == false)
dn = trend == -1 and (close > open or usecol == false) and (body > abody / 5 or usebod == false)

//Lines
plot(center, color = blue, linewidth = 3, transp = 0, title = "PriceChannel Center")

//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 80)

//Trading
if up
    strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if dn
    strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()
    

More