
Chiến lược này sử dụng chỉ số RSI để đánh giá quá mua quá bán, kết hợp với hệ thống đánh giá xu hướng được xây dựng bằng đường nhanh, đường trung và đường chậm, để đánh giá cơ hội đặt vị trí và làm nhiều lỗ hổng khi giá tăng vọt.
Khi đường nhanh vượt qua đường trung và chỉ số RSI cho thấy quá bán, hãy mua nhiều hơn
Khi đường giao dịch vượt qua đường trung bình và RSI cho thấy quá mua, hãy tham gia giao dịch.
Stop loss được đặt là 4% giá nhập cảnh
Lợi nhuận được tạo ra bằng cách dừng hàng loạt, đầu tiên dừng 20% và sau đó dừng 15% khi giá tiếp tục tăng, lần lượt rút khỏi vị trí
Chiến lược này kết hợp với chỉ số đường trung bình và chỉ số RSI để đánh giá cơ hội mua và bán đồng thời nắm bắt xu hướng thay đổi giá, là một trong những chiến lược theo dõi xu hướng phổ biến hơn. Bằng cách kiểm tra tham số và thêm các chỉ số đánh giá hỗ trợ khác, chiến lược có thể được tối ưu hóa và tăng tỷ lệ chiến thắng.
/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 1m
basePeriod: 1m
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/
// © syfuslokust
//@version=4
strategy(shorttitle='CoinruleCombinedCryptoStrat',title='CoinruleCombinedCryptoStrat', overlay=true)
// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)
//Normal
oversold = input(30)
overbought = input(70)
//ALGO
//oversold= input(26)
//overbought= input(80)
//sell pct
SellPct = input(20)
ExitPct = input(15)
//MA inputs and calculations
movingaverage_signal = sma(close, input(9))
movingaverage_fast = sma(close, input(50))
movingaverage_slow = sma(close, input(200))
movingaverage_mid= sma(close, input(100))
//Look Back
inp_lkb = input(12, title='Lookback Long Period')
inp_lkb_2 = input(2, title='Lookback Short Period')
perc_change(lkb) =>
overall_change = ((close[0] - close[lkb]) / close[lkb]) * 100
//Entry
//MA
bullish = crossover(movingaverage_signal, movingaverage_fast)
//Execute buy
strategy.entry(id="long", long = true, when = (RSI < oversold and movingaverage_fast < movingaverage_mid))
//when = crossover(close, movingaverage_signal) and movingaverage_signal < movingaverage_slow and RSI < oversold)
//Exit
//RSI
Stop_loss= ((input (4))/100)
longStopPrice = strategy.position_avg_price * (1 - Stop_loss)
//MA
bearish = crossunder(movingaverage_signal, movingaverage_fast)
//Execute sell
strategy.close("long", qty_percent = SellPct, when = RSI > overbought and movingaverage_fast > movingaverage_mid)
//when = (crossunder(low, movingaverage_signal) and movingaverage_fast > movingaverage_slow and RSI > overbought) or (movingaverage_signal < movingaverage_fast and crossunder(low, movingaverage_fast)) or (low < longStopPrice))
//PLOT
plot(movingaverage_signal, color=color.black, linewidth=2, title="signal")
plot(movingaverage_fast, color=color.orange, linewidth=2, title="fast")
plot(movingaverage_slow, color=color.purple, linewidth=2, title="slow")
plot(movingaverage_mid, color=color.blue, linewidth=2, title="mid")