RSI上升的加密趋势策略是一种适用于较长时间周期(如4小时或更长)的加密货币和股票市场趋势策略。
该策略利用RSI指标识别趋势的上升和下降,结合布林带和变化率指标避免交易盘整行情。根据测试,这种策略在加密货币对加密货币的交易中表现较好,而不是与法定货币交易。
该策略使用以下指标:
具体的交易规则如下:
开仓规则
多头开仓:RSI值上升且布林带和变化率指标表明不在盘整,做多 空头开仓:RSI值下降且布林带和变化率指标表明不在盘整,做空
平仓规则
收到反向信号时平仓
需要注意加大止损幅度,调整布林带和变化率参数组合,并结合基本面分析。
该策略可以从以下几个方面进一步优化:
增加止损机制,设置合理的止损幅度,控制单笔损失。
优化布林带和变化率指标的参数,找到最佳参数组合。可以通过回测优化。
添加其他辅助指标,如MACD、KD等,实现多指标组合,提高信号准确率。
开发断流动模型,在异常波动时暂停交易,避免被套。
利用机器学习方法自动优化参数组合和信号权重。
结合链上数据,关注交易所流动性、资金流向等参数,提高策略的适应性。
RSI上升的加密趋势策略利用RSI指标辅以布林带和变化率指标,实现了较长时间周期内捕捉加密货币市场趋势的效果。该策略优势在于及时捕捉趋势转折,避免被套,适合追踪较长线的方向性机会。但该策略也存在无止损、参数过度依赖等问题。未来可通过止损、参数优化、多指标组合、机器学习等方法进行改进,使策略更稳健可靠。
/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 2h
basePeriod: 15m
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/
// © exlux99
//@version=4
strategy(title = "RSI Rising", overlay = true, initial_capital = 100, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)
/////////////////////
source = close
bb_length = 20
bb_mult = 1.0
basis = sma(source, bb_length)
dev = bb_mult * stdev(source, bb_length)
upperx = basis + dev
lowerx = basis - dev
bbr = (source - lowerx)/(upperx - lowerx)
bbr_len = 21
bbr_std = stdev(bbr, bbr_len)
bbr_std_thresh = 0.1
is_sideways = (bbr > 0.0 and bbr < 1.0) and bbr_std <= bbr_std_thresh
////////////////
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2010, title = "From Year", minval = 1970)
//monday and session
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
sourcex = close
length = 2
pcntChange = 1
roc = 100 * (sourcex - sourcex[length])/sourcex[length]
emaroc = ema(roc, length/2)
isMoving() => emaroc > (pcntChange / 2) or emaroc < (0 - (pcntChange / 2))
periods = input(19)
smooth = input(14, title="RSI Length" )
src = input(low, title="Source" )
rsiClose = rsi(ema(src, periods), smooth)
long=rising(rsiClose,2) and not is_sideways and isMoving()
short=not rising(rsiClose,2) and not is_sideways and isMoving()
if(time_cond)
strategy.entry('long',1,when=long)
strategy.entry('short',0,when=short)