
Chiến lược này là hệ thống giao dịch theo xu hướng dựa trên RSI (Chỉ số sức mạnh tương đối) hai giai đoạn kết hợp với quản lý vị thế theo kiểu kim tự tháp. Chiến lược này so sánh các chỉ báo RSI của hai giai đoạn khác nhau (14 và 30), can thiệp vào đầu xu hướng và tăng vị thế thông qua lệnh giới hạn khi xu hướng tiếp tục, do đó tối đa hóa khả năng nắm bắt xu hướng. Hệ thống được thiết kế với cơ chế kiểm soát rủi ro hoàn chỉnh, bao gồm quản lý vị thế và điều kiện thanh lý động.
Chiến lược này sử dụng tín hiệu giao nhau RSI hai giai đoạn làm điều kiện kích hoạt giao dịch và kết hợp với quản lý vị thế theo kiểu kim tự tháp. Cụ thể:
Chiến lược này nắm bắt tốt xu hướng thông qua sự kết hợp giữa RSI hai giai đoạn và phương pháp thêm vị thế theo kiểu kim tự tháp. Chiến lược này thiết kế một hệ thống giao dịch hoàn chỉnh, bao gồm các yếu tố chính như điểm vào lệnh, tăng vị thế, dừng lỗ và quản lý vị thế. Thông qua việc tối ưu hóa tham số và cải thiện quản lý rủi ro, chiến lược này dự kiến sẽ đạt được hiệu suất ổn định trong giao dịch thực tế. Các nhà giao dịch nên kiểm tra và điều chỉnh đầy đủ các thông số theo đặc điểm cụ thể của thị trường trước khi sử dụng chúng vào giao dịch thực tế.
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-16 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("RSI Top Strategy", overlay=true, pyramiding=2)
qty1 = input( 1 , "Qty first entry", group="Strategy settings")
qty2 = input( 1 , "Qty second entry", group="Strategy settings")
avg1 = input.float( 1.5 , "% averaging ", group="Strategy settings")
overSold = input( 30 , group="open RSI Settings")
overBought = input( 70 , group="open RSI Settings")
rsi1len = input.int(14, minval=1, title="open RSI Length", group="open RSI Settings")
overSold2 = input( 30 , group="close RSI Settings")
overBought2 = input( 70 , group="close RSI Settings")
rsi2len = input.int(30, minval=1, title="close RSI Length", group="close RSI Settings")
price = close
vrsi = ta.rsi(price, rsi1len)
vrsi2 = ta.rsi(price, rsi2len)
sz=strategy.position_size
co = ta.crossover(vrsi, overSold)
cu = ta.crossunder(vrsi, overBought)
if (not na(vrsi))
if (co) and not (sz>0)
strategy.entry("Long", strategy.long, qty = qty1, comment="Long")
Avgl=close-close*0.01*avg1
strategy.entry("AvgL", strategy.long, qty = qty2, limit=Avgl, comment="AvgL")
if (cu) and not (sz<0)
strategy.entry("Short", strategy.short, qty = qty1, comment="Short")
Avgs=close+close*0.01*avg1
strategy.entry("AvgS", strategy.short, qty = qty2, limit=Avgs, comment="AvgS")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
if sz[1]<0 and sz<0 and vrsi2<overBought2 and vrsi2[1]>=overBought2
strategy.close_all("x")
if sz[1]>0 and sz>0 and vrsi2>overSold2 and vrsi2[1]<=overSold2
strategy.close_all("x")
plot(vrsi,'open rsi',color=color.green)
plot(vrsi2,'close rsi',color=color.red)
hline(overBought, "RSI Upper Band", color=#787B86)
hline(overSold, "RSI Upper Band", color=#787B86)