该策略结合了向量蜡烛图(Vector Candles)的概念与传统的通道突破(Channel Breakout)和巧克力酱(Chocolate Sauce, ChoCH)模式识别,旨在捕捉市场的突破性行情。策略通过比较收盘价与前一根K线的高低点,并结合成交量放大的向量蜡烛图来确认信号,同时采用了一定数量的确认K线来过滤噪音。
该策略创新性地将向量蜡烛图与经典的通道突破和ChoCH模式相结合,通过颜色区分和确认K线机制,提高了信号的可靠性和识别度。策略优势在于规则明确、信号直观,同时具有一定的灵活性和可优化空间。然而,策略也存在一些局限性和风险,如在震荡市表现欠佳,对市场趋势把握不足,以及缺乏止损止盈管理等。未来可以从趋势确认、范围交易、参数优化、风险控制等方面对策略进行完善,以期获得更稳健的交易表现。
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Custom ChoCH and BOS Strategy with Vector Candles", overlay=true)
// Input Parameters
length = input(10, title="Lookback Length for Volume")
volMultiplier = input(2.0, title="Volume Multiplier for Vector Candles")
confirmationCandles = input(3, title="Confirmation Candles")
// Calculate the average volume of the last 'length' candles
avgVol = sma(volume, length)
// Vector Candle Definitions
vectorCandleRed = (close < open) and (volume > avgVol * volMultiplier) ? 1.0 : 0.0
vectorCandleGreen = (close > open) and (volume > avgVol * volMultiplier) ? 1.0 : 0.0
vectorCandleBlue = (close < open) and (volume > avgVol * 1.5) ? 1.0 : 0.0 // 150% volume for blue
vectorCandlePurple = (close > open) and (volume > avgVol * 1.5) ? 1.0 : 0.0 // 150% volume for purple
// Detecting BOS and ChoCH
isRedChoCH = vectorCandleRed > 0 and (close < low[1]) // Red ChoCH
isGreenBOS = vectorCandleGreen > 0 and (close > high[1]) // Green BOS
// Confirmation Logic
redChoCHConfirmed = (sum(vectorCandleRed, confirmationCandles) >= 2) ? 1.0 : 0.0
greenBOSConfirmed = (sum(vectorCandleGreen, confirmationCandles) >= 2) ? 1.0 : 0.0
// Entry Conditions
buyCondition = redChoCHConfirmed > 0
sellCondition = greenBOSConfirmed > 0
// Strategy Execution
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.close("Buy")
// Plotting Vector Candles and Signals
plotshape(series=isRedChoCH, title="Red ChoCH Signal", location=location.belowbar, color=color.red, style=shape.circle, text="Red ChoCH")
plotshape(series=isGreenBOS, title="Green BOS Signal", location=location.abovebar, color=color.green, style=shape.circle, text="Green BOS")
// Plotting Vector Candles for Visualization
plotchar(vectorCandleRed > 0, title="Vector Candle Red", location=location.belowbar, color=color.red, char='R', text="Red")
plotchar(vectorCandleGreen > 0, title="Vector Candle Green", location=location.abovebar, color=color.green, char='G', text="Green")
plotchar(vectorCandleBlue > 0, title="Vector Candle Blue", location=location.belowbar, color=color.blue, char='B', text="Blue")
plotchar(vectorCandlePurple > 0, title="Vector Candle Purple", location=location.abovebar, color=color.purple, char='P', text="Purple")