震荡多空RSI换币策略是一种用于加密货币的量化交易策略。它结合了市场技术指标RSI与ICHIMOKU指标,在价格震荡时识别多空信号,实现低买高卖。它适用于中长线周期,如3-4小时以上。
该策略主要基于以下指标和规则:
ICHIMOKU指标
- Tenkan线:过去20根K线的最高最低价中点
- Kijun线:过去50根K线的最高最低价中点
- Senkou A线:Tenkan线与Kijun线的中点
- Senkou B线:过去120根K线的最高最低价中点
- Chikou线:当前K线收盘价的前30根K线
RSI指标 - 区间为0-100 - 高于50为多头信号,低于50为空头信号
入场规则
多头入场:Tenkan线上穿Kijun线(黄金交叉)且价格突破Senkou A&B线,同时RSI高于50
空头入场:Tenkan线下穿Kijun线(死亡交叉)且价格跌破Senkou A&B线,同时RSI低于50
退出规则
与入场相反的信号出现时立即止损离场
该策略综合考虑了中长期趋势、短期资金流动性和超买超卖情况,在震荡行情中捕捉反转机会。它同时设置了止损规则来规避巨额亏损。
1. 多种指标综合判断,确保高确定性
该策略同时考虑ICHIMOKU的趋势和支撑阻力判断、RSI的超买超卖情况,以及K线实体方向的资金流动性,确保信号的可靠性。
2. 适合震荡行情,频繁获利
加密货币市场波动较大,该策略可充分捕捉震荡行情中的反转机会,实现频繁的低买高卖。
3. 防止追涨杀跌,风险可控
策略综合考虑中长期趋势和短期情况,可避免追涨杀跌的风险,同时设置止损规避风险。
1. 可能错过部分运行行情
该策略以反转为主,当出现长时间的运行行情时,策略会频繁震荡打击资金。
2. 单一品种,无法分散风险
策略仅交易单一品种,无法分散市场系统性风险。
3. 极端行情下发生止损
在极端行情下,如跳空、量能爆发等情况时,策略可能会触发止损而被迫离场。
1. 增加止损策略,降低单次亏损
可设置移动止损或余额百分比止损来锁定利润,防止利润归零。
2. 结合股指相关性,分散市场风险
可在股指相关性较强的品种中寻找交易机会,以分散市场系统性风险。
3. 增加条件过滤,减少无效交易
可设置价格波动率、成交量变动等条件过滤,避免无效的反转信号,提高获利概率。
震荡多空RSI换币策略综合运用ICHIMOKU指标和RSI指标判断加密货币的反转点,适合震荡行情的低买高卖获利。它同时设置了止损规则来控制风险。该策略可通过优化止损机制、关联性分散风险和设置条件过滤来进一步增强效果,值得实盘验证。
/*backtest
start: 2023-12-17 00:00:00
end: 2023-12-24 00:00:00
period: 3m
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/
// © exlux99
//@version=4
strategy(title="Ichimoku + RSI Crypto trending strategy", overlay=true, initial_capital = 1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, pyramiding=1 )
UseHAcandles = input(true, title="Use Heikin Ashi Candles in Algo Calculations")
//
// === /INPUTS ===
// === BASE FUNCTIONS ===
haClose = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, close) : close
haOpen = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, open) : open
haHigh = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, high) : high
haLow = UseHAcandles ? security(heikinashi(syminfo.tickerid), timeframe.period, low) : low
//Inputs
ts_bars = input(20, minval=1, title="Tenkan-Sen Bars")
ks_bars = input(50, minval=1, title="Kijun-Sen Bars")
ssb_bars = input(120, minval=1, title="Senkou-Span B Bars")
cs_offset = input(30, minval=1, title="Chikou-Span Offset")
ss_offset = input(30, minval=1, title="Senkou-Span Offset")
long_entry = input(true, title="Long Entry")
short_entry = input(true, title="Short Entry")
//Volatility
//vollength = input(defval=1, title="VolLength")
//voltarget = input(defval=0., type=input.float, step=0.1, title="Volatility Target")
//Difference = abs((haClose - haOpen)/((haClose + haOpen)/2) * 100)
//MovingAverage = sma(Difference, vollength)
//highvolatility = MovingAverage > voltarget
////////////////////////////////////////////////////////////////////////////////
// BACKTESTING RANGE
// From Date Inputs
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 = 2019, title = "From Year", minval = 1970)
// 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)
// Calculate start/end date and time condition
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true
////////////////////////////////////////////////////////////////////////////////
middle(len) => avg(lowest(len), highest(len))
// Ichimoku Components
tenkan = middle(ts_bars)
kijun = middle(ks_bars)
senkouA = avg(tenkan, kijun)
senkouB = middle(ssb_bars)
//RSI
change = change(haClose)
gain = change >= 0 ? change : 0.0
loss = change < 0 ? (-1) * change : 0.0
avgGain = rma(gain, 14)
avgLoss = rma(loss, 14)
rs = avgGain / avgLoss
rsi = 100 - (100 / (1 + rs))
ss_high = max(senkouA[ss_offset-1], senkouB[ss_offset-1])
ss_low = min(senkouA[ss_offset-1], senkouB[ss_offset-1])
// Entry/Exit Signals
tk_cross_bull = tenkan > kijun
tk_cross_bear = tenkan < kijun
cs_cross_bull = mom(haClose, cs_offset-1) > 0
cs_cross_bear = mom(haClose, cs_offset-1) < 0
price_above_kumo = haClose > ss_high
price_below_kumo = haClose < ss_low
rsi_bullish = rsi > 50
rsi_bearish = rs < 50
bullish = tk_cross_bull and cs_cross_bull and price_above_kumo and rsi_bullish //and highvolatility
bearish = tk_cross_bear and cs_cross_bear and price_below_kumo and rsi_bearish //and highvolatility
strategy.entry("Long", strategy.long, when=bullish and long_entry and time_cond)
strategy.entry("Short", strategy.short, when=bearish and short_entry and time_cond)
strategy.close("Long", when=bearish and not short_entry and time_cond)
strategy.close("Short", when=bullish and not long_entry and time_cond)