
Chiến lược này là một hệ thống giao dịch theo dõi xu hướng kết hợp nhiều chỉ số, kết hợp phân tích ba chiều của xu hướng thị trường, động lực và biến động. Lý thuyết cốt lõi là đánh giá xu hướng thị trường thông qua một đám mây chỉ số (Ichimoku Cloud), xác nhận động lực của MACD, lọc tình trạng biến động của thị trường bằng Bollinger Band Width, đồng thời giới thiệu cơ chế xác nhận xu hướng cấp tuần và cuối cùng quản lý rủi ro bằng cách dừng lỗ động dựa trên ATR.
Chiến lược sử dụng cơ chế lọc tín hiệu nhiều lớp: Đầu tiên, xác định xu hướng lớn của thị trường bằng cách đánh giá giá cả trên hoặc dưới đám mây bằng các khoảng A và B dẫn đầu của một chỉ số đám mây; tiếp theo, sử dụng đồ thị MACD để đánh giá cường độ động lực, yêu cầu đồ thị trực tiếp lớn hơn -0.05 trong giờ đầu, nhỏ hơn 0 trong giờ đầu; thứ ba, giới thiệu đường trung bình 50 chu kỳ của chu kỳ thời gian đường tròn để xác nhận hướng xu hướng cấp độ lớn hơn; thứ tư, sử dụng chỉ số băng thông Brin để lọc tỷ lệ biến động thấp, chỉ khi chiều rộng lớn hơn 0.02 khi mở vị trí.
Chiến lược này xây dựng một hệ thống theo dõi xu hướng hoàn chỉnh bằng cách kết hợp các chỉ số đa chiều và phân tích chu kỳ đa thời gian, và được trang bị cơ chế quản lý rủi ro động. Mặc dù phản hồi hoạt động tốt, nhưng vẫn cần chú ý đến rủi ro do sự thay đổi của môi trường thị trường gây ra, nên kiểm tra cẩn thận và tối ưu hóa liên tục trong thực tế.
/*backtest
start: 2024-11-01 00:00:00
end: 2025-02-19 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FIWB
//@version=6
strategy("Momentum Edge Strategy - 1D BTC Optimized", overlay=true)
// --- Input Parameters ---
atrLength = input.int(14, title="ATR Length")
atrMultiplier = input.float(1.5, title="ATR Multiplier")
bbWidthThreshold = input.float(0.02, title="Bollinger Band Width Threshold")
// --- Ichimoku Cloud ---
conversionLine = (ta.highest(high, 9) + ta.lowest(low, 9)) / 2
baseLine = (ta.highest(high, 26) + ta.lowest(low, 26)) / 2
leadingSpanA = (conversionLine + baseLine) / 2
leadingSpanB = (ta.highest(high, 52) + ta.lowest(low, 52)) / 2
priceAboveCloud = close > leadingSpanA and close > leadingSpanB
priceBelowCloud = close < leadingSpanA and close < leadingSpanB
// --- MACD Histogram ---
[_, _, macdHistogram] = ta.macd(close, 12, 26, 9)
// --- Multi-Timeframe Trend Confirmation ---
higherTFTrend = request.security(syminfo.tickerid, "W", close > ta.sma(close, 50))
// --- Bollinger Band Width ---
bbBasis = ta.sma(close, 20)
bbUpper = bbBasis + 2 * ta.stdev(close, 20)
bbLower = bbBasis - 2 * ta.stdev(close, 20)
bbWidth = (bbUpper - bbLower) / bbBasis
// --- ATR-based Stop Loss ---
atrValue = ta.atr(atrLength)
highestHigh = ta.highest(high, atrLength)
lowestLow = ta.lowest(low, atrLength)
longStopLoss = bbWidth < bbWidthThreshold ? lowestLow : close - atrValue * atrMultiplier
shortStopLoss= bbWidth < bbWidthThreshold ? highestHigh : close + atrValue * atrMultiplier
// --- Entry Conditions ---
longCondition = priceAboveCloud and macdHistogram > -0.05 and higherTFTrend and bbWidth > bbWidthThreshold
shortCondition = priceBelowCloud and macdHistogram < 0 and not higherTFTrend and bbWidth > bbWidthThreshold
// --- Strategy Execution ---
if longCondition
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", from_entry="Long", stop=longStopLoss)
if shortCondition
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", from_entry="Short", stop=shortStopLoss)
// --- Plotting ---
plot(leadingSpanA, color=color.new(color.green, 80), title="Leading Span A")
plot(leadingSpanB, color=color.new(color.red, 80), title="Leading Span B")
plotshape(series=longCondition ? close : na, title="Long Signal", location=location.belowbar, color=color.green)
plotshape(series=shortCondition ? close : na, title="Short Signal", location=location.abovebar, color=color.red)