
Đây là một chiến lược giao dịch định lượng trong ngày kết hợp một số chỉ số kỹ thuật một cách hữu cơ, xây dựng một hệ thống tín hiệu giao dịch đa chiều bằng cách tích hợp các chỉ số giao dịch có trọng lượng trung bình (VWAP), mức điều chỉnh Fibonacci, chỉ số tương đối mạnh (RSI) và moving average đơn giản (SMA). Chiến lược này tìm kiếm các cơ hội giao dịch có xác suất cao trong biến động thị trường bằng cách phối hợp với các chỉ số khác nhau.
Chiến lược này sử dụng nhiều lớp lọc để xác nhận tín hiệu giao dịch:
Đây là một chiến lược giao dịch trong ngày toàn diện, có tính logic nghiêm ngặt. Bằng cách phối hợp nhiều chỉ số kỹ thuật, theo đuổi lợi nhuận ổn định trong khi kiểm soát rủi ro. Chiến lược có tính thực tiễn và khả năng mở rộng mạnh mẽ, có thể thích ứng với các môi trường thị trường khác nhau thông qua tối ưu hóa tham số và kiểm soát rủi ro hợp lý. Tuy nhiên, người dùng cần hiểu sâu về đặc điểm của từng chỉ số, đặt tham số hợp lý và luôn chú ý đến kiểm soát rủi ro.
/*backtest
start: 2025-01-25 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// Pine Script v5 kodu
//@version=5
strategy("Intraday Strategy with VWAP, Fibonacci, RSI, and SMA", shorttitle="Intraday Strategy", overlay=true)
// Input settings
lengthRSI = input.int(14, title="RSI Length")
lengthFib = input.int(5, title="Fibonacci Lookback Period")
timeframeVWAP = input.timeframe("", title="VWAP Timeframe")
smaLength = input.int(9, title="SMA Length")
rsi = ta.rsi(close, lengthRSI)
sma = ta.sma(close, smaLength)
[fibHigh, fibLow] = request.security(syminfo.tickerid, timeframe.period, [high, low])
upper = fibHigh - (fibHigh - fibLow) * 0.382
lower = fibHigh - (fibHigh - fibLow) * 0.618
vwav = request.security(syminfo.tickerid, timeframeVWAP, ta.vwap(close))
price_above_vwap = close > vwav
// Trading conditions
buySignalRSI = ta.crossover(rsi, 30) and close > lower and close < upper and price_above_vwap
sellSignalRSI = ta.crossunder(rsi, 70) and close < upper and close > lower and not price_above_vwap
buySignalSMA = ta.crossover(close, sma)
sellSignalSMA = ta.crossunder(close, sma)
finalBuySignal = buySignalRSI or buySignalSMA
finalSellSignal = sellSignalRSI or sellSignalSMA
// Execute trades
if finalBuySignal
strategy.entry("Buy", strategy.long)
if finalSellSignal
strategy.entry("Sell", strategy.short)
// Plot signals
plotshape(finalBuySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(finalSellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Plot VWAP, SMA, and levels
plot(vwav, color=color.blue, title="VWAP")
plot(sma, color=color.yellow, title="SMA 9")
lineUpper = plot(upper, color=color.orange, title="Fibonacci Upper")
lineLower = plot(lower, color=color.purple, title="Fibonacci Lower")