Skip to content

Latest commit

 

History

History
222 lines (129 loc) · 6.12 KB

RSI长线交易策略RSI-Long-Term-Trading-Strategy.md

File metadata and controls

222 lines (129 loc) · 6.12 KB

Name

RSI长线交易策略RSI-Long-Term-Trading-Strategy

Author

ChaoZhang

Strategy Description

[trans]

概述

本策略使用RSI指标判断长线趋势方向,结合K线形态、价格突破等要素产生长线交易信号。属于利用RSI指标的长周期跟踪策略类型。

策略原理

该策略主要基于以下两点进行判断:

  1. RSI指标

    计算20周期RSI值,判断长期趋势方向。

  2. K线形态

    判断过去3根K线的收盘价变动情况,确认趋势方向。

    • 3根K线收盘价累积变动大于350,确定为上涨趋势
    • 3根K线收盘价累积变动小于-200,确定为下跌趋势

当上涨趋势同时RSI大于30时做多;当下跌趋势时做空。

整体来看,策略综合考虑RSI趋势判断和ک 线形态,在较长周期内判断趋势方向。

策略优势

  • RSI指标判断长期趋势方向
  • 结合K线形态确认趋势
  • 多种要素综合判断,提高准确率
  • 长周期操作,避免过于频繁交易
  • RSI参数和判断阈值可自定义

策略风险

  • RSI指标容易出现滞后现象
  • K线形态判断规则较为简单
  • 未考虑止损策略,良性止损尤为重要
  • 长周期操作,无法对短期调整做出反应
  • 不同品种参数判断阈值需要分别测试

可以通过以下措施降低风险:

  • 优化RSI参数,找到最佳周期参数
  • 添加其他技术指标进行确认,例如MACD
  • 加入移动止损或百分比止损策略
  • 考虑在短周期内做额外的小资金操作
  • 根据不同品种分别测试指标参数和阈值

优化方向

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

  1. 测试RSI不同参数,找到最优参数

    例如测试10、15、30周期RSI的参数效果

  2. 添加MACD等指标进行确认

    例如RSI判断上涨时,MACD也需同时金叉才入场

  3. 优化止损策略

    考虑移动止损或 trails123等止损方式

  4. 分时段优化参数

    不同时间段市场特性不一,可以做参数优化

  5. 考虑加入短周期策略

    在长周期基础上,串加短周期策略来应对短线调整

总结

本策略通过RSI判断长期趋势方向,并辅以K线形态和价格突破确认,实现长周期持仓操作。这可以有效过滤短期市场噪音,专注于大趋势。但RSI滞后和止损策略不完善等问题依然存在。我们可以通过参数优化、加入确认指标、止损策略优化来改进,使策略在长短周期结合更加灵活,在回撤控制更加可靠,从而实现稳定的长线持续盈利。

||

Overview

This strategy uses the RSI indicator to determine long-term trend direction, combined with candlestick patterns and price breakouts to generate long-term trading signals. It belongs to the RSI-based long cycle tracking strategy type.

Strategy Logic

The strategy is based on two main factors:

  1. RSI Indicator

    Calculates 20-period RSI to determine overall trend direction.

  2. Candlestick Patterns

    Judging price change over past 3 candles to confirm the trend.

    • Accumulated close change over 350 indicates uptrend
    • Accumulated close change below -200 indicates downtrend

It goes long when uptrend and RSI is above 30, and goes short when downtrend.

Overall it considers both RSI trend and candlestick patterns over longer periods to determine trends.

Advantages

  • RSI judges long-term trend direction
  • Candlestick patterns confirm the trend
  • Multiple factors improve accuracy
  • Longer cycle avoids over-trading
  • Customizable RSI parameters and thresholds

Risks

  • RSI can lag trend changes
  • Simple candlestick pattern rules
  • No stop loss mechanism, good exits are critical
  • Long cycles cannot react to short adjustments
  • Thresholds need separate tuning for different products

Risks can be reduced by:

  • Optimizing RSI parameters for best periods
  • Adding other indicators like MACD for confirmation
  • Adding moving or percentage stops
  • Consider additional small trades for short cycles
  • Test parameters and thresholds separately for different products

Enhancement Directions

The strategy can be improved by:

  1. Testing different RSI periods for optimal parameters

    e.g. test 10, 15, 30 period RSI

  2. Adding confirmation indicators

    e.g. require MACD golden cross for RSI uptrend

  3. Optimizing stops

    Consider moving stops, trails123 etc.

  4. Time-based parameter optimization

    Optimize parameters separately for different sessions

  5. Adding short-term strategies

    Combine short-term strategies to react to temporary adjustments

Summary

This long-term strategy uses RSI for trend direction, confirmed by candlestick patterns and breakouts, to focus on major trends while avoiding short-term noise. However, issues like RSI lag and weak stops exist. Improvements can be made via parameter optimization, adding confirmations, optimizing stops to combine short-term flexibility with long-term persistence, enabling stable long-term profitability.

[/trans]

Strategy Arguments

Argument Default Description
v_input_1 10 Max Intraday Loss(%)

Source (PineScript)

/*backtest
start: 2022-09-14 00:00:00
end: 2023-09-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/


//@version=2
// use with eurusd h1 , gbpusd h1
strategy("RSI Long Term", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 10)
RSI = (rsi(sum(close , 20) + sum(open ,20) , 20 ))
Sum_OF_3_Both = sum((close - open)*100000 , 3) 
Up_Move = ((close[0] - open[0])*100000) < 35



Down_Move = ((close[6] - open[6])*100000) + ((close[5] - open[5])*100000) + ((close[4] - open[4])*100000) < -400


maxIdLossPcnt = input(10, "Max Intraday Loss(%)", type=float)

// strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)
//total =  (num > 70 )

if (Sum_OF_3_Both > 350 and Up_Move )
    strategy.entry("Bar Up Buy", strategy.long)

if (Sum_OF_3_Both < -200  and Down_Move and RSI > 30.1  )
    strategy.entry("Bar Down Sell ", strategy.short)

//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

Detail

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

Last Modified

2023-09-21 20:54:08