양방향 반전 및 동력 이동 평균 전략

저자:차오장, 날짜: 2023-11-06 16:18:18
태그:

img

전반적인 설명

이 전략은 역전 거래 규칙을 동력 지표와 결합합니다. 더 신뢰할 수있는 거래 신호를 생성하기 위해 동력 신호를 검증하는 동안 역전 기회를 식별하기 위해 양방향 역전 및 Chande 동력 오시레이터를 통합합니다.

전략 논리

이 전략은 두 부분으로 구성됩니다.

첫 번째 부분은 양방향 반전 거래 규칙이다. 이는 전날 두 일 동안의 클로즈 가격 변화를 탐지함으로써 반전 기회를 식별한다. 구체적으로, 만약 클로즈 가격이 전날 두 일 동안 감소하고, 현재 클로즈 가격이 전날 클로즈보다 높고, 스토카스틱 오시레이터가 한 임계치 이하라면, 구매 신호를 유발한다. 반대로, 만약 전날 두 일 동안 클로즈 가격이 증가하고, 현재 클로즈 가격이 전날 클로즈보다 낮고, 스토카스틱 오시레이터가 한 임계치 이상의 경우, 판매 신호를 유발한다.

두 번째 부분은 데 모멘텀 오시일레이터이다. 모멘텀을 결정하기 위해 특정 기간의 평균 규모와 가격 변화의 크기를 비교한다. 모멘텀 지표가 상위 한도를 넘으면 구매 신호를 생성한다. 하위 한도를 넘으면 판매 신호를 생성한다.

이 전략은 양방향 반전 거래 규칙을 결합하여 잠재적 인 반전 지점을 찾고, 반전 신호의 유효성을 확인하기 위해 모멘텀 지표를 결합합니다. 두 신호가 동의 할 때만 실제 구매 또는 판매 신호가 생성됩니다.

전략 의 장점

  • 이중 검증 메커니즘은 잘못된 신호를 피함으로써 신호 신뢰성을 향상시킵니다. 역전 거래 규칙은 잠재적 인 역전 지점을 식별하고 동력 지표는 역전 신호의 효과를 확인합니다.

  • 역전 전략과 트렌드 전략을 결합하면 역전 및 트렌드 시장에서 기회를 잡을 수 있는 유연성을 제공합니다.

  • 모멘텀을 도입하면 모멘텀이 확정되면 거래만 하면 역전 함정에 빠지는 것을 방지합니다.

  • 여러 가지 조정 가능한 매개 변수를 다양한 시장 조건에 최적화 할 수 있습니다.

전략 의 위험

  • 반전 신호는 큰 인기를 얻을 수 있으며 합리적인 스톱 손실이 필요합니다.

  • 정해진 시기는 어렵고 잘못된 판단을 일으킬 수 있습니다.

  • 모멘텀 지표의 지연은 최고의 반전 입구 지점을 놓치는 원인이 될 수 있습니다.

  • 매개 변수 조정은 특정 시장을 기반으로 신중한 최적화가 필요합니다. 부적절한 설정은 위험을 증가시킬 수 있습니다.

적절한 스톱 로스, 강력한 매개 변수 최적화, 반전 신호 트리거 조건에서 약간의 공간을 유지하는 등으로 위험을 줄일 수 있습니다.

최적화 위한 지침

  • 시장 반전에 민감한 매개 변수를 찾기 위해 다른 반전 매개 변수 조합을 테스트합니다.

  • 다른 모멘텀 지표, 예를 들어 RSI, 부피 변화율 등을 시도해보세요.

  • 비중이 없는 전환점을 피하기 위해 브레이크업과 같은 필터를 추가합니다.

  • 최대 마감 통제 방법을 찾기 위해 스톱 로스 전략을 평가합니다.

  • 포지션 크기를 시장 조건에 따라 조정하기 위한 포지션 크기 전략을 평가합니다.

결론

이 전략은 역전 및 동력 전략의 장점을 신뢰성있는 신호와 기회를 포착하는 유연성으로 결합합니다. 매개 변수는 최적화 될 수 있으며 안정성과 수익성을 향상시키기 위해 스톱 로스 및 포지션 사이징을 통해 위험을 관리 할 수 있습니다. 전반적으로 역전 및 트렌드 전략의 효과적인 통합을 탐구하고 있으며 추가 연구 및 응용 가치가 있습니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 18/08/2019
// 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 indicator plots Chande Momentum Oscillator. This indicator was 
//    developed by Tushar Chande. A scientist, an inventor, and a respected 
//    trading system developer, Mr. Chande developed the CMO to capture what 
//    he calls "pure momentum". For more definitive information on the CMO and 
//    other indicators we recommend the book The New Technical Trader by Tushar 
//    Chande and Stanley Kroll.
//    The CMO is closely related to, yet unique from, other momentum oriented 
//    indicators such as Relative Strength Index, Stochastic, Rate-of-Change, 
//    etc. It is most closely related to Welles Wilder`s RSI, yet it differs 
//    in several ways:
//        - It uses data for both up days and down days in the numerator, thereby 
//          directly measuring momentum;
//        - The calculations are applied on unsmoothed data. Therefore, short-term 
//          extreme movements in price are not hidden. Once calculated, smoothing 
//          can be applied to the CMO, if desired;
//        - The scale is bounded between +100 and -100, thereby allowing you to 
//          clearly see changes in net momentum using the 0 level. The bounded scale 
//          also allows you to conveniently compare values across different securities.
//
// 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

CMO(Length, TopBand, LowBand) =>
    pos = 0
    xMom = abs(close - close[1])
    xSMA_mom = sma(xMom, Length)
    xMomLength = close - close[Length]
    nRes = 100 * (xMomLength / (xSMA_mom * Length))
    pos :=  iff(nRes > TopBand, 1,
	         iff(nRes <= LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Chande Momentum Oscillator", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthCMO = input(9, minval=1)
TopBand = input(70, minval=1)
LowBand = input(-70, maxval=-1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posCMO = CMO(LengthCMO, TopBand, LowBand)
pos = iff(posReversal123 == 1 and posCMO == 1 , 1,
	   iff(posReversal123 == -1 and posCMO == -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 )

더 많은