
Theo phân tích kỹ thuật, chỉ số RSI cao hơn 70 nên đại diện cho tình trạng mua quá mức và do đó thuộc về tín hiệu bán. Tiền điện tử đại diện cho một loại tài sản hoàn toàn mới, nó tái tạo khái niệm phân tích kỹ thuật.
Xây dựng một chiến lược giao dịch theo xu hướng dựa trên RSI, thường được coi là chỉ số đảo ngược, có vẻ như trái với trực giác. Tuy nhiên, với hơn 200 lần kiểm tra lại, đây là một thiết lập chiến lược dài hạn rất thú vị.
Chiến lược này giả định rằng mỗi lệnh giao dịch 30% số tiền có sẵn. Nó tính đến phí giao dịch 0,1% tương ứng với phí cơ bản của Binance.
Chiến lược này sử dụng chỉ số RSI để xác định xu hướng xu hướng, theo dõi xu hướng tăng lên và giảm dần. So với cách sử dụng RSI giảm giá truyền thống, chiến lược này cung cấp những suy nghĩ mới.
/*backtest
start: 2024-01-02 00:00:00
end: 2024-02-01 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=1
strategy(shorttitle='Trend-following RSI Scalping Strategy (by Coinrule)',title='Trend-following RSI Strategy ', overlay=true, initial_capital = 1000, default_qty_type = strategy.percent_of_equity, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month")
fromDay = input(defval = 10, title = "From Day")
fromYear = input(defval = 2020, title = "From Year")
thruMonth = input(defval = 1, title = "Thru Month")
thruDay = input(defval = 1, title = "Thru Day")
thruYear = input(defval = 2112, title = "Thru Year")
showDate = input(defval = true, title = "Show Date Range")
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => true
// RSI inputs and calculations
lengthRSI = input(14, title = 'RSI period', minval=1)
RSI = rsi(close, lengthRSI)
//Entry
strategy.entry(id="long", long = true, when = RSI > 70 and window())
//Exit
Take_profit= ((input (6))/100)
longTakeProfit = strategy.position_avg_price * (1 + Take_profit)
strategy.close("long", when = RSI < 55 or close > longTakeProfit and window())