STARC Channel Backtest Strategy

Author: ChaoZhang, Date: 2023-12-05 14:52:20
Tags:

img

Overview

The STARC Channel Backtest Strategy is a quantitative trading strategy based on the STARC indicator. The strategy constructs the upper and lower STARC channels to generate breakout buy and sell trading signals. It also incorporates long and short position switching mechanisms to adapt to different market environments.

Strategy Principle

The core of the STARC Channel Backtest Strategy is the STARC indicator, which includes:

  • Baseline: n-day simple moving average SMA
  • Upper band: SMA + K × Average True Range ATR
  • Lower band: SMA - K × ATR

It generates a buy signal when the closing price breaks through the upper band, and a sell signal when the closing price breaks through the lower band.

The strategy calculates the upper and lower rails of the STARC channel daily and judges if the closing price breaks through them to generate trading signals. It also sets a reverse parameter to switch between long and short positions to adapt to different market conditions.

Advantage Analysis

The STARC Channel Backtest Strategy has the following advantages:

  1. Construct upper and lower channels with the STARC indicator, good backtesting results;
  2. Built-in long and short position switching mechanisms to adapt to various market environments;
  3. Flexible parameter settings, both K values and moving average lengths can be adjusted and optimized;
  4. Clear and easy-to-understand strategy rules that are easy to understand and implement;
  5. Visualized indicators to intuitively judge market positions.

Risk Analysis

The STARC Channel Backtest Strategy also has some risks:

  1. The STARC indicator is often used for medium-long term trading, and short-term results may not be optimal;
  2. Breakout trading is prone to getting caught in whipsaws which requires strict stop losses;
  3. Improper reverse parameter settings can lead to excessive frequent trading;
  4. Improper parameter optimization can lead to curve fitting.

The following measures should be taken to mitigate risks:

  1. Select appropriate trading cycles, such as daily and other medium-long term cycles;
  2. Set reasonable stop loss positions to control single trade losses;
  3. Carefully set reverse parameters to avoid excessive switching of positions;
  4. Multi-parameter optimization to prevent overfitting.

Optimization Directions

The main optimization directions for the STARC Channel Backtest Strategy include:

  1. Parameter optimization: adjust moving average lengths, K values, ATR cycles and other parameters to find the optimal parameter combination;
  2. Add stop loss mechanisms: set trailing stop loss, time stop loss, percentage stop loss etc. to control risks;
  3. Incorporate other indicators: add trading volume, Bollinger Bands etc. for filtration to improve efficiency;
  4. Dynamically adjust parameters: automatically optimize and adjust parameters based on market changes to improve stability.

These optimization directions can improve the strategy’s return and stability while controlling risks.

Conclusion

The overall effect of the STARC Channel Backtest Strategy is good. It implements medium-long term breakout trading based on the STARC indicator. The advantage of the strategy is using the STARC channel to generate stable trading signals, while setting reverse mechanisms to adapt to market changes. We also need to mitigate risks by setting stop losses and optimizing parameters to make the strategy more stable and efficient. In general, this strategy is an effective tool for medium-long term breakout trading.


/*backtest
start: 2023-11-04 00:00:00
end: 2023-12-04 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 23/04/2018
// A type of technical indicator that is created by plotting two bands around 
// a short-term simple moving average (SMA) of an underlying asset's price. 
// The upper band is created by adding a value of the average true range 
// (ATR) - a popular indicator used by technical traders - to the moving average. 
// The lower band is created by subtracting a value of the ATR from the SMA.
// STARC is an acronym for Stoller Average Range Channels. The indicator is 
// named after its creator, Manning Stoller.
//
// You can change long to short in the Input Settings
// WARNING:
//  - For purpose educate only
//  - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="STARC Bands Backtest", overlay = true)
LengthMA = input(5, minval=1)
LengthATR = input(15, minval=1)
K = input(1.33, minval=0.01, step = 0.01)
reverse = input(false, title="Trade reverse")
xMA = sma(close, LengthMA)
xATR = atr(LengthATR)
xSTARCBandUp = xMA + xATR * K
xSTARCBandDn = xMA - xATR * K
pos = iff(close > xSTARCBandUp, 1,
       iff(close < xSTARCBandDn, -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(xMA, color=blue, title="MA")
plot(xSTARCBandUp, color = green, title="UpBand")
plot(xSTARCBandDn, color=red, title="DnBand")

More