Skip to content

Latest commit

 

History

History
320 lines (226 loc) · 12.6 KB

Noro的快速RSI切换策略v17Fast-Scalping-RSI-Switching-Strategy-v17.md

File metadata and controls

320 lines (226 loc) · 12.6 KB

Name

Noro的快速RSI切换策略v17Fast-Scalping-RSI-Switching-Strategy-v17

Author

ChaoZhang

Strategy Description

IMG [trans]

概述

Noro的快速RSI切换策略是一种利用RSI指标识别超买超卖机会的量化交易策略。该策略同时结合了K线形态、均线过滤和止损方法,以控制风险。

该策略主要基于以下几个关键组件:

  1. 快速RSI指标:用于识别超买超卖机会
  2. K线形态:结合K线实体和阴阳线,辅助判断趋势
  3. 均线过滤:利用SMA均线进行过滤,避免虚假信号
  4. 止损机制:结合RSI极限区域,实现止损

策略原理

Noro的快速RSI切换策略主要判断以下几种买卖信号:

  1. 快速RSI超买超卖信号:当快速RSI上穿其上限或下穿其下限时,产生交易信号。

  2. K线形态信号:结合K线实体大小、阴阳线方向等,判断趋势,辅助快速RSI产生信号。

  3. 均线过滤信号:结合SMA均线方向,避免出现假突破。

  4. 止损信号:当快速RSI回穿其上限或下限时,平仓止损。

具体来说,该策略基于快速RSI的超买超卖区间来判断交易机会。当快速RSI下穿其下限,视为超卖信号;当快速RSI上穿其上限,视为超买信号。

为了避免噪音,策略加入以下辅助判断:

  1. K线实体大小:K线实体越大,趋势越明显
  2. 阴阳线:判断K线趋势方向
  3. SMA均线:过滤假突破信号
  4. 止损:快速RSI回穿限定区域时止损

所以,该策略同时结合快速RSI、K线形态、均线和止损来实现交易决策。

策略优势

该策略具有以下几点优势:

  1. 快速RSI灵敏度高:可以快速捕捉超买超卖机会
  2. K线及均线辅助判断:避免噪音交易
  3. 自动止损:可以及时止损,控制风险
  4. 适合短线交易:适用于短线周期如1小时、30分钟等
  5. 容易优化:可以调整参数,适应不同市场

策略风险

该策略也存在一定的风险:

  1. 可能出现连续止损:在震荡行情中,会出现较多止损信号
  2. 参数需要优化:不同周期和品种,需要调整参数
  3. 无法完全避免亏损:及时止损也会带来一定程度的亏损

为降低风险,可以从以下几个方面进行优化:

  1. 优化快速RSI参数,降低噪音交易
  2. 优化止损位置,控制单笔亏损
  3. 增加资金管理模块,分散风险

策略优化方向

该策略可以从以下几个方面进行优化:

  1. 增加止盈策略:在利润到达一定水平后止盈,锁定部分利润
  2. 增加资金管理:加入仓位控制、风险分散等管理手段
  3. 不同周期参数优化:调整指标参数,测试不同周期的效果
  4. 增加机器学习:使用算法自动优化参数,适应市场变化
  5. 不同品种测试:在更多品种中测试策略健壮性

通过止盈、风险管理、参数优化、机器学习等手段进一步完善该策略,能够大幅提高策略稳定性。

总结

总的来说,Noro的快速RSI切换策略结合快速RSI指标与辅助K线技术指标,实现了一个对超买超卖进行判断的短线交易策略。该策略响应敏捷、易优化,同时加入了止损模块来控制风险。通过进一步的机器学习及参数优化,有望获得更好的策略效果。

||

Overview

Noro’s Fast Scalping RSI Switching Strategy is a quantitative trading strategy that identifies overbought and oversold opportunities using the RSI indicator. The strategy also incorporates candlestick patterns, moving average filters and stop loss methods to control risk.

The key components of this strategy include:

  1. Fast RSI Indicator: Identify overbought and oversold levels
  2. Candlestick Patterns: Assist in determining trend directionality
  3. Moving Average Filter: Use SMA to avoid false signals
  4. Stop Loss Mechanism: Implement stop loss based on RSI limits

Strategy Logic

Noro’s Fast Scalping RSI Switching Strategy mainly identifies the following trading signals:

  1. Fast RSI Overbought/Oversold Signals: Trade signals are generated when fast RSI crosses above its upper limit or below its lower limit.

  2. Candlestick Signals: Candlestick parameters like body size and direction are used to determine trend and supplement fast RSI signals.

  3. SMA Filter Signals: SMA direction filters out false breakout signals.

  4. Stop Loss Signals: Positions are closed when fast RSI crosses back above its upper limit or below its lower limit.

Specifially, this strategy identifies trading opportunities based on the overbought and oversold zones of the fast RSI. The fast RSI crossing below its lower limit signals an oversold condition; while crossing above its upper limit signals an overbought condition.

To avoid noise, the following supplementary conditions are added:

  1. Candle Body Size: Larger candle bodies represent a stronger trend
  2. Candle Direction: Determines bullish or bearish trend
  3. SMA Filter: Filters out false breakout signals
  4. Stop Loss: Exits trades when fast RSI crosses back past its limits

Therefore, this strategy combines fast RSI, candlesticks, moving average and stop loss together to generate trading signals.

Advantages

The advantages of this strategy include:

  1. Fast RSI is Sensitive: Quickly captures overbought/oversold opportunities
  2. Candlestick & MA Filter: Avoids false signals
  3. Automatic Stop Loss: Effectively controls risks
  4. Suitable for Scalping: Works well with shorter timeframes e.g. 1H, 30M
  5. Easy to Optimize: Parameters can be tuned for different markets

Risks

There are also some risks to consider:

  1. Consecutive Stop Loss: More stop loss signals may occur in ranging markets
  2. Parameter Optimization Needed: Parameters need tuning for different pairs and timeframes
  3. Unable to Avoid All Losses: Timely stop loss still results in some losses

The following optimization methods can help mitigate risks:

  1. Optimize Fast RSI Parameters: Reduce false signals
  2. Optimize Stop Loss Placement: Control single trade loss size
  3. Add Position Sizing: Distribute risks across multiple trades

Optimization Directions

Some ways to further optimize this strategy include:

  1. Add Profit Taking Exits: Take partial profits when hitting profit targets
  2. Enhance Risk Management: Incorporate position sizing rules to diversify risks
  3. Parameter Tuning: Test effect of parameter adjustments across timeframes
  4. Machine Learning: Use algorithms to automatically optimize parameters over time
  5. Robustness Testing: Evaluate strategy performance across more symbol pairs

By incorporating profit taking, risk management, parameter optimization, machine learning and robustness testing, the strategy can be significantly enhanced in stability.

Conclusion

In summary, Noro’s Fast Scalping RSI Switching Strategy combines the fast RSI indicator with supplementary candlestick analysis to identify overbought and oversold trading opportunities. With quick signal response times, ease of optimization and incorporated stop loss modules, this short-term trading strategy has strong potential to generate positive results after further machine learning and parameter tuning.

[/trans]

Strategy Arguments

Argument Default Description
v_input_1 true Long
v_input_2 true Short
v_input_3 false Use Martingale
v_input_4 100 Capital, %
v_input_5 true Use Fast RSI Strategy
v_input_6 true Use Min/Max Strategy
v_input_7 true Use BarColor Strategy
v_input_8 false Use SMA Filter
v_input_9 20 SMA Filter Period
v_input_10 7 Fast RSI Period
v_input_11 30 RSI limit
v_input_12_close 0 RSI Price: close
v_input_13 true RSI Bars
v_input_14 true Min/Max Bars
v_input_15 false Show SMA Filter
v_input_16 false Show Arrows
v_input_17 2018 From Year
v_input_18 2100 To Year
v_input_19 true From Month
v_input_20 12 To Month
v_input_21 true From day
v_input_22 31 To day

Source (PineScript)

/*backtest
start: 2023-12-14 00:00:00
end: 2023-12-18 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's Fast RSI Strategy v1.7", shorttitle = "Fast RSI str 1.7", overlay = true)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usemar = input(false, defval = false, title = "Use Martingale")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
usersi = input(true, defval = true, title = "Use Fast RSI Strategy")
usemm = input(true, defval = true, title = "Use Min/Max Strategy")
usebc = input(true, defval = true, title = "Use BarColor Strategy")
usesma = input(false, defval = false, title = "Use SMA Filter")
smaperiod = input(20, defval = 20, minval = 2, maxval = 1000, title = "SMA Filter Period")
fast = input(7, defval = 7, minval = 2, maxval = 50, title = "Fast RSI Period")
limit = input(30, defval = 30, minval = 1, maxval = 100, title = "RSI limit")
rsisrc = input(close, defval = close, title = "RSI Price")
rsibars = input(1, defval = 1, minval = 1, maxval = 20, title = "RSI Bars")
mmbars = input(1, defval = 1, minval = 1, maxval = 5, title = "Min/Max Bars")
showsma = input(false, defval = false, title = "Show SMA Filter")
showarr = input(false, defval = false, title = "Show Arrows")
fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Fast RSI
fastup = rma(max(change(rsisrc), 0), fast)
fastdown = rma(-min(change(rsisrc), 0), fast)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//Limits
bar = close > open ? 1 : close < open ? -1 : 0
uplimit = 100 - limit
dnlimit = limit

//RSI Bars
upsignal = fastrsi > uplimit ? 1 : 0
dnsignal = fastrsi < dnlimit ? 1 : 0
uprsi = sma(upsignal, rsibars) == 1
dnrsi = sma(dnsignal, rsibars) == 1

//Body
body = abs(close - open)
abody = sma(body, 10)

//MinMax Bars
min = min(close, open)
max = max(close, open)
minsignal = min < min[1] and bar == -1 and bar[1] == -1 ? 1 : 0
maxsignal = max > max[1] and bar == 1 and bar[1] == 1 ? 1 : 0
mins = sma(minsignal, mmbars) == 1
maxs = sma(maxsignal, mmbars) == 1

//SMA Filter
sma = sma(close, smaperiod)
colorsma = showsma ? blue : na
plot(sma, color = colorsma, linewidth = 3)

//Signals
up1 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and dnrsi and body > abody / 5 and usersi
dn1 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and uprsi and body > abody / 5 and usersi
up2 = mins and (close > sma or usesma == false) and fastrsi < 70 and usemm
dn2 = maxs and (close < sma or usesma == false) and fastrsi > 30 and usemm 
up3 = sma(bar, 2) == -1 and usebc
dn3 = sma(bar, 2) == 1 and usebc
exit = (((strategy.position_size > 0 and fastrsi > dnlimit and bar == 1) or (strategy.position_size < 0 and fastrsi < uplimit and bar == -1)) and body > abody / 2)

//Arrows
col = exit ? black : up1 or dn1 ? blue : up2 or dn2 ? red : na
needup = up1 or up2
needdn = dn1 or dn2
needexitup = exit and strategy.position_size < 0
needexitdn = exit and strategy.position_size > 0
plotarrow(showarr and needup ? 1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needdn ? -1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needexitup ? 1 : na, colorup = black, colordown = black, transp = 0)
plotarrow(showarr and needexitdn ? -1 : na, colorup = black, colordown = black, transp = 0)

//Trading
profit = exit ? ((strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price)) ? 1 : -1 : profit[1]
mult = usemar ? exit ? profit == -1 ? mult[1] * 2 : 1 : mult[1] : 1
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 * mult : lot[1]

if up1 or up2 or up3
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot)

if dn1 or dn2 or dn3
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot)
    
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
    strategy.close_all()

Detail

https://www.fmz.com/strategy/436252

Last Modified

2023-12-22 15:10:40