
Chiến lược này là một hệ thống giao dịch đường ngắn dựa trên lý thuyết phân tách và lưới tự điều chỉnh, kết hợp các ngưỡng biến động để tối ưu hóa thời gian giao dịch. Hệ thống điều chỉnh mức lưới một cách động, nắm bắt sự thay đổi cấu trúc nhỏ của thị trường trong thời gian biến động cao, đồng thời tránh giao dịch quá mức trong thời gian biến động thấp. Chiến lược tích hợp nhiều chỉ số kỹ thuật bao gồm trung bình sóng thực (ATR), trung bình di chuyển đơn giản (SMA) và điểm đột phá phân tách, xây dựng một khuôn khổ quyết định giao dịch toàn diện.
Trung tâm của chiến lược là xây dựng mạng lưới giao dịch động thông qua nhận dạng phân dạng và tập hợp biến động. Thực hiện cụ thể bao gồm một số bước quan trọng sau:
Đây là một hệ thống chiến lược tổng hợp kết hợp lý thuyết phân tách, giao dịch lưới và lọc tỷ lệ biến động. Bằng cách sử dụng nhiều chỉ số kỹ thuật kết hợp, nó có thể nắm bắt hiệu quả cấu trúc vi mô của thị trường. Ưu điểm của chiến lược là khả năng tự thích ứng và kiểm soát rủi ro, nhưng cũng cần chú ý đến các vấn đề về tối ưu hóa tham số và thích ứng với môi trường thị trường.
/*backtest
start: 2024-02-17 00:00:00
end: 2025-02-15 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Adaptive Fractal Grid Scalping Strategy", overlay=true)
// Inputs
atrLength = input.int(14, title="ATR Length")
smaLength = input.int(50, title="SMA Length")
gridMultiplierHigh = input.float(2.0, title="Grid Multiplier High")
gridMultiplierLow = input.float(0.5, title="Grid Multiplier Low")
trailStopMultiplier = input.float(0.5, title="Trailing Stop Multiplier")
volatilityThreshold = input.float(1.0, title="Volatility Threshold (ATR)")
// Calculate Fractals
fractalHigh = ta.pivothigh(high, 2, 2)
fractalLow = ta.pivotlow(low, 2, 2)
// Calculate ATR and SMA
atrValue = ta.atr(atrLength)
smaValue = ta.sma(close, smaLength)
// Determine Trend Direction
isBullish = close > smaValue
isBearish = close < smaValue
// Calculate Grid Levels
gridLevelHigh = fractalHigh + atrValue * gridMultiplierHigh
gridLevelLow = fractalLow - atrValue * gridMultiplierLow
// Plot Fractals and Grid Levels
plotshape(not na(fractalHigh), style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
plotshape(not na(fractalLow), style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plot(gridLevelHigh, color=color.red, linewidth=1, title="Grid Level High")
plot(gridLevelLow, color=color.green, linewidth=1, title="Grid Level Low")
// Trade Execution Logic with Volatility Threshold
if (atrValue > volatilityThreshold)
if (isBullish and not na(fractalLow))
strategy.entry("Buy", strategy.long, limit=gridLevelLow)
if (isBearish and not na(fractalHigh))
strategy.entry("Sell", strategy.short, limit=gridLevelHigh)
// Profit-Taking and Stop-Loss
strategy.exit("Take Profit/Stop Loss", "Buy", limit=gridLevelHigh, stop=fractalLow - atrValue * trailStopMultiplier)
strategy.exit("Take Profit/Stop Loss", "Sell", limit=gridLevelLow, stop=fractalHigh + atrValue * trailStopMultiplier)