양방향 반전 및 모멘텀 이동 평균 전략


생성 날짜: 2023-11-06 16:18:18 마지막으로 수정됨: 2023-11-06 16:18:18
복사: 0 클릭수: 639
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

양방향 반전 및 모멘텀 이동 평균 전략

개요

이 전략은 역전 전략과 동력 지표의 결합으로 사용되는 조합 전략이다. 이 전략은 양방향 역전 전략과 산체 동력 진동기를 통합하여 역전 기회를 발견하면서 동력 신호를 검증하여 더 신뢰할 수 있는 거래 신호를 구현한다.

전략 원칙

이 전략은 두 부분으로 구성되어 있습니다.

첫 번째 부분은 양방향 역전 전략이다. 그것은 이전 이틀의 종결 가격 변화를 감지하여 역전 기회를 판단한다. 구체적으로, 만약 이전 이틀의 종결 가격이 감소하고, 그날의 종결 가격이 전날의 종결 가격보다 상승하고, 그리고 무작위 지표가 설정된 수준보다 낮다면, 구매 신호이다. 반대로, 만약 이전 이틀의 종결 가격이 증가하고, 그날의 종결 가격이 전날의 종결 가격보다 떨어지고, 그리고 무작위 지표가 설정된 수준보다 높다면, 판매 신호이다.

두 번째 부분은 香氏動量振動器 (香氏動量振動器) 이다. 그것은 가격 변화의 양과 일정 주기 동안의 평균 변화의 크기를 비교하여 동력을 판단한다. 동력 지표가 설정된 상한보다 높으면 구매 신호로, 설정된 하한보다 낮으면 판매 신호로 사용된다.

이 전략은 쌍방향 역전 판단 역전점과 동력 지표 검증 동력 상황을 종합적으로 사용하며, 두 신호가 동향될 때만 실제 구매/판매 신호를 생성한다.

전략적 이점

  • 이중 검증 메커니즘, 거짓 신호를 피하고 신호의 신뢰성을 높인다. 역전 전략은 잠재적인 역점 판단, 역량 지표 검증 역전 신호의 유효성.

  • 역전 전략과 트렌드 전략이 결합되어 역전과 트렌드를 동시에 고려하여 시장 기회를 유연하게 포착합니다.

  • 동력 지표를 도입하여 역전 함정을 피하고 동력이 확인된 경우에만 거래한다.

  • 다양한 매개 변수를 조정할 수 있으며, 시장에 맞게 최적화할 수 있다.

전략적 위험

  • 회전 신호는 회전 깊이가 커서 합리적인 정지비가 필요하다.

  • 역전 시점을 잡는 것은 정확성이 필요하며, 잘못된 판단이 발생할 수 있습니다.

  • 동력 지표가 지연되어 최적의 회전 시점을 놓칠 수 있다.

  • 매개 변수 설정은 특정 시장에 따라 신중하게 최적화되어야 하며, 잘못된 설정은 거래 위험을 증가시킬 수 있다.

합리적인 스톱로스를 통해 단위 손실을 제어할 수 있다. 파라미터 설정을 최적화하고, 파라미터 안정성을 추구한다. 리버스 신호 촉발 조건을 적절히 완화하고, 일정 범위를 유지하는 등의 방법을 통해 위험을 줄일 수 있다.

전략 최적화 방향

  • 시장의 역동에 민감한 파라미터 설정을 찾기 위해 다양한 역동 파라미터 조합을 테스트한다.

  • 다른 동력 지표들을 시도해 보세요. 상대적 강도, 수송량 변화율 등이죠.

  • 비중있는 전환점을 피하기 위해 돌파구와 같은 필터 조건을 추가하십시오.

  • 손해 방지 전략을 평가하고, 최대한의 회수 가능한 손해 방지 방법을 찾습니다.

  • 포지션 제어 전략을 평가하고, 시장 상황에 따라 포지션 크기를 조정한다.

요약하다

이 전략은 반전 전략과 동력 전략의 장점을 결합하고, 신호 신뢰도가 높고, 시장 기회를 잡는 데 유연한 장점이 있다. 변수 최적화, 스톱 로즈 관리, 포지션 제어 등의 방법을 통해 위험을 줄이고, 전략의 안정성과 수익성을 향상시킬 수 있다. 전체적으로 이 전략은 반전 전략과 트렌드 전략의 효과적인 결합을 개척적으로 탐구했으며, 추가 연구와 응용에 가치가 있다.

전략 소스 코드
/*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 )