破底回补策略是一种典型的低买高卖策略。它利用RSI指标识别超卖点,在价格下跌到一定程度后发出买入信号,以较低的价格 Accumulate 代币;当价格重新上涨时,通过设定 RSI 退出阈值来实现盈利了结。该策略适用于中长线持有,可以有效过滤震荡行情中的假突破,实现持币成本的优化。
该策略主要基于 RSI 指标来识别超卖点。RSI 指标的正常范围在 0 到 100 之间。当 RSI 指标下跌到设定的入场阈值 35 以下时,发出买入信号;当 RSI 指标重新上涨到设定的退出阈值 65 以上时,发出卖出信号。这样可以在价格趋势反转的时候及时入场和退出, implementing 实现低买高卖。
另外,策略中还引入了 100 周期的简单移动平均线,与 RSI 指标形成组合条件,只有当价格下跌到移动平均线以下,同时 RSI 进入超卖区域,才会触发买入信号。这可以有效过滤部分假突破情况,减少不必要的交易。
破底回补策略整体来说是一个稳健实用的低买高卖策略。通过 RSI 和移动平均线的双重过滤,可以有效抑制误信号,在优化后的参数下,可以获得较低的持币成本。与此同时,适当优化指标参数,调整仓位策略,有望获得更高的资金使用效率。
/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-17 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/
// © Coinrule
//@version=4
strategy(shorttitle='Optimized RSI Strategy',title='Optimized RSI Strategy - Buy The Dips (by Coinrule)', 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", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 1, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2020, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
// RSI inputs and calculations
lengthRSI = (14)
RSI = rsi(close, lengthRSI)
RSI_entry = input(35, title = 'RSI Entry', minval=1)
RSI_exit = input(65, title = 'RSI Close', minval=1)
//Calculate Moving Averages
movingaverage_signal = sma(close, input(100))
//Entry
strategy.entry(id="long", long = true, when = RSI< RSI_entry and close < movingaverage_signal and window())
//Exit
//RSI
strategy.close("long", when = RSI > RSI_exit and window())
plot (movingaverage_signal)