
Chiến lược này là một hệ thống giao dịch quay trở lại giá trị trung bình nhiều cấp dựa trên chỉ số RSI và biến động giá. Nó sử dụng giá trị cực đoan và biến động giá lớn bất thường của RSI làm tín hiệu đầu vào, đồng thời sử dụng tăng cường kim tự tháp và dừng động để quản lý rủi ro và tối ưu hóa lợi nhuận. Ý tưởng cốt lõi của chiến lược này là vào thị trường khi có biến động cực đoan và thu lợi nhuận khi giá trở lại mức bình thường.
Điều kiện tham gia:
Cơ chế gia tăng:
Cơ chế ra sân:
Kiểm soát rủi ro:
Nhiều cấp độ nhập: Bằng cách thiết lập nhiều RSI và ngưỡng biến động, chiến lược có thể nắm bắt các mức độ khác nhau của các tình huống cực đoan của thị trường, tăng cơ hội giao dịch.
Động lực dừng: dựa trên hỗ trợ / kháng cự điểm dừng tính toán, có thể điều chỉnh tùy theo cấu trúc thị trường, cả hai bảo vệ lợi nhuận và không rời khỏi sân quá sớm.
Lưu trữ theo kiểu kim tự tháp: Tăng số lượng nắm giữ khi xu hướng tiếp tục, có thể làm tăng đáng kể tiềm năng lợi nhuận.
Quản lý rủi ro: Kiểm soát hiệu quả rủi ro trên mỗi giao dịch và rủi ro tổng thể bằng cách cố định tỷ lệ rủi ro và giới hạn nắm giữ tối đa.
Tính linh hoạt: Một số tham số có thể điều chỉnh cho phép chiến lược thích ứng với các môi trường thị trường và các loại giao dịch khác nhau.
Phản hồi trung bình + theo dõi xu hướng: kết hợp các lợi ích của Phản hồi trung bình và theo dõi xu hướng, có thể nắm bắt được sự đảo ngược ngắn hạn và không bỏ lỡ xu hướng lớn.
Giao dịch quá mức: có thể thường xuyên kích hoạt tín hiệu giao dịch trong thị trường biến động cao, dẫn đến phí xử lý quá cao.
Lỗi đột phá giả: Thị trường có thể có những biến động cực đoan ngắn ngủi sau khi hồi phục nhanh chóng, gây ra tín hiệu sai.
Mất liên tục: Nếu thị trường tiếp tục di chuyển một chiều, nó có thể dẫn đến mất mát lớn sau nhiều lần gia tăng.
Tính nhạy cảm của tham số: Hiệu suất của chiến lược có thể rất nhạy cảm với cài đặt tham số, có nguy cơ quá phù hợp.
Tác động của điểm trượt: Trong thời gian biến động mạnh, có thể có điểm trượt nghiêm trọng ảnh hưởng đến hiệu suất chiến lược.
Tùy thuộc vào môi trường thị trường: Chiến lược có thể không hoạt động tốt trong một số môi trường thị trường, chẳng hạn như thị trường biến động thấp hoặc xu hướng mạnh.
Điều chỉnh tham số động: giới thiệu cơ chế thích ứng, điều chỉnh RSI và giá trị giảm biến động theo tình trạng thị trường.
Phân tích nhiều chu kỳ thời gian: kết hợp với xu hướng thị trường lâu dài hơn, cải thiện chất lượng nhập cảnh.
Tối ưu hóa Stop Loss: Tăng Stop Loss theo dõi hoặc Stop Loss động dựa trên ATR để kiểm soát rủi ro hơn nữa.
Trình lọc trạng thái thị trường: Thêm các điều kiện lọc như cường độ xu hướng, chu kỳ biến động và tránh giao dịch trong môi trường thị trường không phù hợp.
Tối ưu hóa quản lý tiền: thực hiện quản lý vị trí chi tiết hơn, chẳng hạn như điều chỉnh quy mô giao dịch theo các mức tín hiệu khác nhau.
Tích hợp học máy: Sử dụng các thuật toán học máy để tối ưu hóa lựa chọn tham số và quá trình tạo tín hiệu
Phân tích liên quan: Thêm vào phân tích liên quan với các tài sản khác, tăng sự ổn định và đa dạng của chiến lược.
Chiến lược giao dịch quay trở RSI đa tầng là một hệ thống giao dịch định lượng được thiết kế cẩn thận, nó kết hợp một cách khéo léo các kỹ thuật phân tích kỹ thuật, quản lý rủi ro động và kỹ thuật tăng cường theo kiểu kim tự tháp. Chiến lược này thể hiện tiềm năng lợi nhuận mạnh mẽ bằng cách nắm bắt sự biến động cực đoan của thị trường và lợi nhuận khi giá quay trở lại. Tuy nhiên, nó cũng đối mặt với những thách thức như giao dịch quá mức và phụ thuộc vào môi trường thị trường.
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('Retorno_Pivots_5min_Novo_v3.3')
// Input variables
bars_left1 = input(1, title = "Entry - Pivot Left Bars")
bars_right1 = input(1, title = "Entry - Pivot Right Bars")
rsi20_longentry0 = input(35, title = "Entry 1 - RSI20 Long")
rsi20_shortentry0 = input(65, title = "Entry 1 - RSI20 Short")
bar_size_entry0 = input.float(1, title="Entry 1 - Bar Size")
rsi20_longentry1 = input(30, title = "Entry 2 - RSI20 Long")
rsi20_shortentry1 = input(70, title = "Entry 2 - RSI20 Short")
bar_size_entry1 = input.float(0.8, title="Entry 2 - Bar Size")
rsi20_longentry2 = input(25, title = "Entry 3 - RSI20 Long")
rsi20_shortentry2 = input(75, title = "Entry 3 - RSI20 Short")
bar_size_entry2 = input.float(0.7, title="Entry 3 - Bar Size")
rsi20_longentry3 = input(20, title = "Entry 4 - RSI20 Long")
rsi20_shortentry3 = input(80, title = "Entry 4 - RSI20 Short")
bar_size_entry3 = input.float(0.5, title="Entry 4 - Bar Size")
limit_perc1 = input.float(0.60, title="Profit Range 1")
limit_perc2 = input.float(0.40, title="Profit Range 2")
limit_perc3 = input.float(0.20, title="Profit Range 3")
limit_perc4 = input.float(0.00, title="Profit Range 4")
limit_perc5 = input.float(0.00, title="Profit Range 5")
minimum_pivot_distance = input.float(0, title="Minimum Pivot Distance %")
barsize_1h_input = input(288, title="Highest Bar Lookback")
rsi20 = ta.rsi(close, 20)
rsi200 = ta.rsi(close, 200)
Pivot_High_Last1 = ta.valuewhen(ta.pivothigh(high, bars_left1, bars_right1), ta.pivothigh(high, bars_left1, bars_right1), 0)
Pivot_Low_Last1 = ta.valuewhen(ta.pivotlow(low, bars_left1, bars_right1), ta.pivotlow(low, bars_left1, bars_right1), 0)
barsize = math.abs(close - open)
barsize_1h = ta.highest(barsize, barsize_1h_input)
Bar0Long = rsi20 < rsi20_longentry0 and barsize >= (barsize_1h * bar_size_entry0)
Bar1Long = rsi20 < rsi20_longentry1 and barsize >= (barsize_1h * bar_size_entry1)
Bar2Long = rsi20 < rsi20_longentry2 and barsize >= (barsize_1h * bar_size_entry2)
Bar3Long = rsi20 < rsi20_longentry3 and barsize >= (barsize_1h * bar_size_entry3)
// Long Entries
Long_Entry1 = strategy.opentrades == 0 and rsi20 < rsi20[1] and ((rsi20 < rsi20_longentry0 and barsize >= (barsize_1h * bar_size_entry0)) or (rsi20 < rsi20_longentry1 and barsize >= (barsize_1h * bar_size_entry1)) or (rsi20 < rsi20_longentry2 and barsize >= (barsize_1h * bar_size_entry2)) or (rsi20 < rsi20_longentry3 and barsize >= (barsize_1h * bar_size_entry3))) and close < (Pivot_Low_Last1 * (1 - (minimum_pivot_distance / 100)))
Long_Entry2 = strategy.opentrades == 1 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry3 = strategy.opentrades == 2 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry4 = strategy.opentrades == 3 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry5 = strategy.opentrades == 4 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
if Long_Entry1 or Long_Entry2 or Long_Entry3 or Long_Entry4 or Long_Entry5
strategy.entry("Long", strategy.long, comment = "ENTER-LONG_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
// Longs Exits
Long_Exit1 = strategy.opentrades == 1 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc1))
Long_Exit2 = strategy.opentrades == 2 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc2))
Long_Exit3 = strategy.opentrades == 3 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc3))
Long_Exit4 = strategy.opentrades == 4 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc4))
Long_Exit5 = strategy.opentrades == 5 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc5))
if Long_Exit1 or Long_Exit2 or Long_Exit3 or Long_Exit4 or Long_Exit5
strategy.close("Long", comment = "EXIT-LONG_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
Bar0Short = rsi20 > rsi20_shortentry0 and barsize >= (barsize_1h * bar_size_entry0)
Bar1Short = rsi20 > rsi20_shortentry1 and barsize >= (barsize_1h * bar_size_entry1)
Bar2Short = rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2)
Bar3Short = rsi20 > rsi20_shortentry3 and barsize >= (barsize_1h * bar_size_entry3)
// Short Entries
Short_Entry1 = strategy.opentrades == 0 and rsi20 > rsi20[1] and ((rsi20 > rsi20_shortentry0 and barsize >= (barsize_1h * bar_size_entry0)) or (rsi20 > rsi20_shortentry1 and barsize >= (barsize_1h * bar_size_entry1)) or (rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2)) or (rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2))) and close > (Pivot_High_Last1 * (1 + (minimum_pivot_distance / 100)))
Short_Entry2 = strategy.opentrades == 1 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry3 = strategy.opentrades == 2 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry4 = strategy.opentrades == 3 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry5 = strategy.opentrades == 4 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
if Short_Entry1 or Short_Entry2 or Short_Entry3 or Short_Entry4 or Short_Entry5
strategy.entry("Short", strategy.short, comment = "ENTER-SHORT_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
// Short Exits
Short_Exit1 = strategy.opentrades == 1 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc1))
Short_Exit2 = strategy.opentrades == 2 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc2))
Short_Exit3 = strategy.opentrades == 3 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc3))
Short_Exit4 = strategy.opentrades == 4 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc4))
Short_Exit5 = strategy.opentrades == 5 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc5))
if Short_Exit1 or Short_Exit2 or Short_Exit3 or Short_Exit4 or Short_Exit5
strategy.close("Short", comment = "EXIT-SHORT_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
// Plots
plot(rsi20, color=color.new(#fbff00, 0), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc1))), color=color.new(#00ff2a, 0), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc2))), color=color.new(#00ff2a, 50), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc3))), color=color.new(#00ff2a, 80), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc4))), color=color.new(#00ff2a, 100), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc1)), color=color.new(#ff0000, 0), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc2)), color=color.new(#ff0000, 50), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc3)), color=color.new(#ff0000, 80), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc4)), color=color.new(#ff0000, 100), linewidth=2)
plot(strategy.position_avg_price, color=color.new(#ffc400, 0), linewidth=2)
plot(strategy.opentrades * (strategy.position_size / math.abs(strategy.position_size)), color=color.new(#ff00bb, 0), linewidth=2)
plot(((barsize / barsize_1h) * 100), color=color.new(#0000ff, 0), linewidth=2)