더블 인버전 CMO 퀀텀 전략


생성 날짜: 2024-01-04 14:35:23 마지막으로 수정됨: 2024-01-04 14:35:23
복사: 0 클릭수: 557
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

더블 인버전 CMO 퀀텀 전략

개요

이 전략은 123 역전 지표와 CMOWMA 양자 지표를 결합한 이중 역전 전략으로, 가격 역전 신호의 이중 확인을 구현하고, 빨간색 녹색 색조의 K선 시각 효과를 갖는다.

전략 원칙

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

  1. 123 역전 지표

    • 마감 가격과 어제 마감 가격의 크기와의 관계를 사용하여 가격 상승 또는 하락을 판단합니다.
    • Stochastic 지표의 빠른 선과 느린 선의 교차를 사용하여 역전 신호를 확인합니다.
    • 조건이 충족되면 더 많은 또는 빈 신호를 생성
  2. CMOWMA 양자 지표

    • CMO 지표를 사용하여 가격 동력을 측정합니다.
    • CMO 지표에 대한 WMA 가중 이동 평균
    • CMO 지표는 높습니다.

두 부분의 신호가 동방향으로 위치한다.

전략적 이점

  1. 이중 확인 메커니즘, 위조 필터링 및 무용지물 감소
  2. 빨간색, 초록색 K선 색조, 시각적 효과, 시장 상황을 쉽게 판단할 수 있다
  3. 회전 및 운동량 지표의 조합을 사용하여 전체적으로 안정성이 좋습니다.
  4. 간단한 매개 변수 설정, 다양한 품종에 적합하며, 쉽게 구현할 수 있습니다.

전략적 위험

  1. 역전 후에도 역전될 수 있고, 꼬리가 될 위험이 있습니다.
  2. 포지션이 자주 변경되어 과도한 거래 비용이 발생합니다.
  3. 잘못 설정된 파라미터는 신호를 너무 많이 또는 너무 적게 만들 수 있습니다.
  4. CMO 매개 변수는 품종 특성에 따라 조정해야 합니다.

리스크를 줄일 수 있는 방법들은 적절히 느슨한 반전 조건, 보유 시간을 늘리는 방법, 변수 조합을 최적화하는 방법 등이다.

전략 최적화

  1. 다른 스토카스틱 변수들이 효과에 미치는 영향을 테스트할 수 있다
  2. MACD, KDJ 등과 같은 다른 지표와 함께 대안 또는 추가 확인이 가능합니다.
  3. 다른 CMO 및 WMA 길이 변수의 최적화를 테스트할 수 있습니다.
  4. 특정 레벨에 스톱 스톱을 추가할 수 있습니다.
  5. 필터링 조건을 설정하여 창고 열 빈도를 제어할 수 있습니다.

요약하다

이 전략은 전체적으로 튼튼하고, 매개 변수가 단순하며, 실행하기 쉬운 동시에 가격 역전과 동력 지표와 결합하여, 효과적인 쌍용 신호 필터링 메커니즘을 형성하여, 가짜 신호를 필터링할 수 있으며, K선 염색 효과는 직관적이다. 매개 변수 최적화 및 위험 통제를 통해 전략 성능을 더욱 향상시킬 수 있다.

전략 소스 코드
/*backtest
start: 2023-12-04 00:00:00
end: 2024-01-03 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 19/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 Chandre Momentum Oscillator and its WMA on the 
//    same chart. This indicator plots the absolute value of CMO.
//    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

CMOWMA(Length, LengthWMA) =>
    pos = 0
    xMom = abs(close - close[1])
    xSMA_mom = sma(xMom, Length)
    xMomLength = close - close[Length]
    nRes = 100 * (xMomLength / (xSMA_mom * Length))
    xWMACMO = wma(nRes, LengthWMA)
    pos := iff(nRes > xWMACMO, 1,
    	   iff(nRes <= xWMACMO, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & CMO & WMA", 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(14, minval=1)
LengthWMA = input(13, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posCMOWMA = CMOWMA(LengthCMO, LengthWMA)
pos = iff(posReversal123 == 1 and posCMOWMA == 1 , 1,
	   iff(posReversal123 == -1 and posCMOWMA == -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 )