The Highest/Lowest Center Lookback strategy is a trend following strategy. Its main idea is to calculate the middle price of the highest and lowest prices over a certain period in the past as the benchmark price, and then calculate the entry zone and exit zone based on this benchmark price combined with volatility. When the price enters the entry zone, go long; when the price enters the exit zone, close the position.
The strategy is mainly implemented through the following steps:
In this way, it can track the trend in time when price enters a trend state; at the same time, risk can be controlled through volatility.
This strategy has the following advantages:
The strategy also has some risks:
To control these risks, optimization can be done in the following aspects:
The strategy also has room for further optimization:
Through these optimizations, further improvements in strategy stability and profitability can be expected.
The Highest/Lowest Center Lookback strategy is a simple and practical trend following strategy. It can capture price changes in time, track trends, while controlling risk through volatility. The strategy is easy to implement, suitable for quantitative trading beginners to learn and practice. By optimizing parameters and rules, the strategy performance can be further improved. In general, this is a recommended quantitative strategy.
/*backtest start: 2023-11-27 00:00:00 end: 2023-12-27 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Highest/Lowest Center Lookback Strategy", overlay=true) lookback_length = input(200, type=input.integer, minval=1, title="Lookback Length") smoother_length = input(5, type=input.integer, minval=1, title="Smoother Length") atr_length = input(10, type=input.integer, minval=1, title="ATR Length") atr_multiplier = input(1.5, type=input.float, minval=0.5, title="ATR Multiplier") vola = atr(atr_length) * atr_multiplier price = sma(close, 3) l = ema(lowest(low, lookback_length), smoother_length) h = ema(highest(high, lookback_length), smoother_length) center = (h + l) * 0.5 upper = center + vola lower = center - vola trend = price > upper ? true : (price < lower ? false : na) bull_cross = crossover(price, upper) bear_cross = crossunder(price, lower) strategy.entry("Buy", strategy.long, when=bull_cross) strategy.close("Buy", when=bear_cross) plot(h, title="High", color=color.red, transp=75, linewidth=2) plot(l, title="Low", color=color.green, transp=75, linewidth=2) pc = plot(center, title="Center", color=color.black, transp=25, linewidth=2) pu = plot(upper, title="Upper", color=color.green, transp=75, linewidth=2) pl = plot(lower, title="Lower", color=color.red, transp=75, linewidth=2) fill(pu, pc, color=color.green, transp=85) fill(pl, pc, color=color.red, transp=85) bgcolor(trend == true ? color.green : (trend == false ? color.red : color.gray), transp=85)