
Chiến lược này kết hợp các khái niệm của Vector Candles với các mô hình truyền thống như Channel Breakout và Chocolate Sauce, nhằm mục đích nắm bắt các hành vi đột phá của thị trường. Chiến lược này xác nhận tín hiệu bằng cách so sánh giá bán với các điểm cao và thấp của một đường K trước đó và kết hợp với các biểu đồ vector tăng cường tổng hợp, đồng thời sử dụng một số đường K xác nhận để lọc tiếng ồn.
Chiến lược này kết hợp một cách sáng tạo các đồ thị vector với các mô hình phá vỡ kênh và ChoCH cổ điển, cải thiện độ tin cậy và nhận dạng tín hiệu thông qua phân biệt màu sắc và xác nhận K-line. Ưu điểm của chiến lược là quy tắc rõ ràng, tín hiệu trực quan, đồng thời có một số không gian linh hoạt và có thể tối ưu hóa. Tuy nhiên, chiến lược cũng có một số hạn chế và rủi ro, chẳng hạn như hoạt động kém trong thị trường xung đột, thiếu hiểu biết về xu hướng thị trường và thiếu quản lý dừng lỗ.
/*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")