
Chiến lược này xác định điểm mua và bán thông qua giao điểm của chỉ số RSI với đường trung bình của nó, thuộc chiến lược giao dịch ngắn. Chiến lược sẽ mua khi chỉ số RSI thấp hơn đường trung bình của nó và bán khi cao hơn đường trung bình của nó, thuộc chiến lược mua bán cao điển hình.
Đây là một chiến lược đảo ngược xu hướng điển hình, sử dụng tính năng mua bán quá mức của chỉ số RSI để xác định thời gian mua bán. Chiến lược này có một số lợi thế:
Nói chung, đây là một chiến lược giao dịch ngắn gọn đơn giản và thực tế.
Chiến lược này cũng có một số rủi ro cần lưu ý:
Những rủi ro này có thể được giảm bớt bằng cách tối ưu hóa tham số, thêm các điều kiện lọc.
Chiến lược này có thể được tối ưu hóa từ các khía cạnh sau:
Có thể cải thiện đáng kể hiệu suất chiến lược thông qua các phương tiện như kết hợp nhiều chỉ số, quản lý lỗ hổng và tối ưu hóa tham số.
Chiến lược này nói chung là một chiến lược giao dịch đường ngắn rất điển hình và thực tế. Nó sử dụng các chỉ số RSI để đánh giá thời gian mua và bán, sau đó được hỗ trợ bằng bộ lọc đồng bằng. Lập luận của chiến lược đơn giản và rõ ràng, điều chỉnh tham số linh hoạt, dễ thực hiện.
/*backtest
start: 2022-11-24 00:00:00
end: 2023-11-30 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © I11L
//@version=5
strategy("I11L - Meanreverter 4h", overlay=false, pyramiding=3, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false)
frequency = input.int(10)
rsiFrequency = input.int(40)
buyZoneDistance = input.int(5)
avgDownATRSum = input.int(3)
useAbsoluteRSIBarrier = input.bool(true)
barrierLevel = 50//input.int(50)
momentumRSI = ta.rsi(close,rsiFrequency)
momentumRSI_slow = ta.sma(momentumRSI,frequency)
isBuy = momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) //and (momentumRSI < barrierLevel or not(useAbsoluteRSIBarrier))
isShort = momentumRSI > momentumRSI_slow*(1+buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))
momentumRSISoftClose = (momentumRSI > momentumRSI_slow) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))
isClose = momentumRSISoftClose
plot(momentumRSI,color=isClose ? color.red : momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) ? color.green : color.white)
plot(momentumRSI_slow,color=color.gray)
plot(barrierLevel,color=useAbsoluteRSIBarrier ? color.white : color.rgb(0,0,0,0))
plot(momentumRSI_slow*(1-buyZoneDistance/100),color=color.gray)
plot(momentumRSI_slow*(1+buyZoneDistance/100),color=color.gray)
plot(momentumRSI_slow*(1+(buyZoneDistance*2)/100),color=color.gray)
// plot(strategy.wintrades - strategy.losstrades)
if(isBuy)
strategy.entry("Buy",strategy.long, comment="#"+str.tostring(strategy.opentrades+1))
// if(isShort)
// strategy.entry("Sell",strategy.short, comment="#"+str.tostring(strategy.opentrades+1))
if(isClose)
strategy.exit("Close",limit=close)