123 역전 및 평형 RSI의 복합 전략

저자:차오장, 날짜: 2023-10-16 16:27:32
태그:

img

전반적인 설명

이 전략은 123 역전 패턴과 부드러운 RSI 지표를 결합하여 높은 승률을 위해 트렌드 역전 지점을 더 정확하게 캡처합니다. 그것은 모든 시간 프레임과 도구에 적용 될 수있는 매우 다재다능한 트렌드 역전 거래 전략입니다.

전략 논리

  1. 123 반전 패턴 식별: 앞날 두 날의 닫는 가격이 높은-저하점을 형성하고 셋째 날의 닫는 것이 전날보다 높을 때 하위 반전 신호. 앞날 두 날의 닫는 가격이 낮은-고위점을 형성하고 셋째 날의 닫는 것이 전날보다 낮을 때 최상위 반전 신호.

  2. 평형 RSI 지표: 평형 RSI는 가중 이동 평균을 사용하여 정상적인 RSI의 지연을 감소시킵니다. 높은 임계값을 넘은 RSI는 구매 신호입니다. 낮은 임계값을 넘은 RSI는 판매 신호입니다.

  3. 전략 신호: 123 반전 패턴과 평형 RSI 신호가 일치 할 때만 거래 신호가 생성됩니다. 123 반전이 바닥을 표시하고 RSI가 높은 수준을 넘을 때 구매합니다. 123 반전이 정상과 RSI가 낮은 수준을 넘을 때 판매합니다.

장점

  1. 트렌드 지표 RSI와 반전 패턴을 결합하면 트렌드 반전 지점을 정확하게 식별 할 수 있습니다.

  2. 평형 RSI는 정상적인 RSI의 지연 문제를 줄입니다.

  3. 123 반전 패턴은 간단하고 쉽게 식별됩니다.

  4. 유연한 매개 변수는 다른 도구와 시간 프레임에 맞게 조정할 수 있습니다.

  5. 고 확장성으로 최적화하고 개선하기 쉽습니다.

위험성

  1. 간단한 123 회전으로 인해 소규모 후퇴 시에는 잘못된 신호가 발생할 수 있습니다.

  2. 부드러운 RSI 최적화는 충분하지 않으며 과도하게 적합합니다.

  3. 이중 확인은 거래 신호를 줄여줍니다.

  4. 거래 비용은 무시되어 작은 계좌가 수익을 얻지 못하게 할 수 있습니다.

  5. 손해를 줄이기 위한 스톱 로스 메커니즘이 없습니다.

강화

  1. 가장 좋은 조합을 찾기 위해 RSI 매개 변수를 최적화합니다.

  2. 신호 필터링을 위한 다른 지표나 패턴을 추가합니다.

  3. 단일 거래 손실을 통제하기 위해 스톱 로스를 구현합니다.

  4. 거래 비용을 고려하고 다른 자본 규모에 대한 매개 변수를 조정합니다.

  5. 최적의 매개 변수를 얻기 위해 다른 기기와 시간 프레임에 대한 테스트 매개 변수

  6. 자동 매개 변수 최적화를 위한 기능을 추가합니다.

요약

이 전략은 명확하고 간단한 논리를 가지고 있으며, 역전 패턴을 트렌드 지표와 결합하여 잠재적 인 트렌드 역전을 식별합니다. 광범위한 적용 가능성과 쉬운 최적화의 장점이 있지만 주목하고 개선해야 할 몇 가지 위험이 있습니다. 전반적으로 더 많은 연구와 응용을받을 가치가있는 다재다능하고 실용적인 단기 역전 거래 전략입니다.


/*backtest
start: 2023-09-15 00:00:00
end: 2023-10-15 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 20/07/2021
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// This is new version of RSI oscillator indicator, developed by John Ehlers. 
// The main advantage of his way of enhancing the RSI indicator is smoothing 
// with minimum of lag penalty. 
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos


SRSI(Length, TopBand,LowBand) =>
    pos = 0.0
    xValue = (close + 2 * close[1] + 2 * close[2] + close[3] ) / 6
    CU23 = sum(iff(xValue > xValue[1], xValue - xValue[1], 0), Length)
    CD23 = sum(iff(xValue < xValue[1], xValue[1] - xValue, 0), Length)
    nRes = iff(CU23 + CD23 != 0, CU23/(CU23 + CD23), 0)
    pos:= iff(nRes > TopBand, 1,
    	   iff(nRes < LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Smoothed RSI", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Smoothed RSI ----")
LengthRSI = input(10, minval=1)
TopBand = input(0.8, step=0.01)
LowBand = input(0.2, step=0.01)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSRSI = SRSI(LengthRSI, TopBand,LowBand )
pos = iff(posReversal123 == 1 and posSRSI == 1 , 1,
	   iff(posReversal123 == -1 and posSRSI == -1, -1, 0)) 
possig = iff(reverse and pos == 1, -1,
          iff(reverse and pos == -1 , 1, pos))	   
if (possig == 1 ) 
    strategy.entry("Long", strategy.long)
if (possig == -1 )
    strategy.entry("Short", strategy.short)	 
if (possig == 0) 
    strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

더 많은