컴보 양적 트렌드 추적 전략

저자:차오장, 날짜: 2024-02-27 15:54:24
태그:

img

전반적인 설명

이 전략의 핵심 아이디어는 123 역전 전략과 무지개 오시레이터 지표를 결합하여 이중 트렌드 추적을 달성하고 전략의 승률을 향상시키는 것입니다. 이 전략은 단기 및 중장기 가격 추세를 동적으로 추적함으로써 벤치마크보다 초과 수익을 달성하기 위해 포지션을 조정합니다.

원칙

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

  1. 123 역전 전략: 지난 2일 동안의 폐쇄 가격이 하락하고 오늘 상승하고 9일간의 느린 K 라인이 50 이하인 경우 긴 라인을 가십시오.

  2. 레인보우 오시일레이터 지표: 이 지표는 이동 평균에 비해 가격의 오차 정도를 반영합니다. 지표가 80보다 높을 때 시장이 불안정해 지는 경향이 있음을 나타냅니다. 지표가 20보다 낮을 때 시장이 역전되는 경향이 있음을 나타냅니다.

이 전략은 긴 신호와 짧은 신호가 나타나면 포지션을 열고 그렇지 않으면 포지션을 평평하게합니다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. 이중 필터는 신호 품질을 향상시키고 잘못된 판단을 줄입니다.
  2. 동적 위치 조정은 일방 시장에서 손실을 줄입니다.
  3. 안정성 향상을 위해 단기 및 중기 지표를 통합합니다.

위험 분석

이 전략의 위험은 다음과 같습니다.

  1. 부적절한 매개 변수 최적화는 과도한 부착으로 이어질 수 있습니다.
  2. 이중 개방은 거래 비용을 증가시킵니다.
  3. 가격 변동이 심할 때 손해를 막는 지점은 취약합니다.

이러한 위험은 매개 변수를 조정하고, 포지션 관리를 최적화하고, 스톱 로스를 합리적으로 설정함으로써 완화될 수 있습니다.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 가장 좋은 매개 변수 조합을 찾기 위해 매개 변수를 최적화합니다.
  2. 포지션 관리 모듈을 추가하여 변동성과 마감에 따라 포지션을 동적으로 조정합니다.
  3. 스톱 손실 모듈을 높이고 합리적인 이동 스톱 손실을 설정합니다.
  4. 인플렉션 포인트를 판단하는 데 도움이 되는 머신 러닝 알고리즘을 강화합니다.

결론

이 전략은 이중 트렌드 추적을 달성하기 위해 123 역전 전략과 무지개 오시레이터 지표를 통합합니다. 높은 안정성을 유지하면서 과도한 수익을 얻을 가능성이 있습니다. 전략의 수익성을 향상시키기 위해 추가 최적화가 가능합니다.


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/05/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
// Ever since the people concluded that stock market price movements are not 
// random or chaotic, but follow specific trends that can be forecasted, they 
// tried to develop different tools or procedures that could help them identify 
// those trends. And one of those financial indicators is the Rainbow Oscillator 
// Indicator. The Rainbow Oscillator Indicator is relatively new, originally 
// introduced in 1997, and it is used to forecast the changes of trend direction.
// As market prices go up and down, the oscillator appears as a direction of the 
// trend, but also as the safety of the market and the depth of that trend. As 
// the rainbow grows in width, the current trend gives signs of continuity, and 
// if the value of the oscillator goes beyond 80, the market becomes more and more 
// unstable, being prone to a sudden reversal. When prices move towards the rainbow 
// and the oscillator becomes more and more flat, the market tends to remain more 
// stable and the bandwidth decreases. Still, if the oscillator value goes below 20, 
// the market is again, prone to sudden reversals. The safest bandwidth value where 
// the market is stable is between 20 and 80, in the Rainbow Oscillator indicator value. 
// The depth a certain price has on a chart and into the rainbow can be used to judge 
// the strength of the move.
//
// 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


RO(Length, LengthHHLL) =>
    pos = 0.0
    xMA1 = sma(close, Length)
    xMA2 = sma(xMA1, Length)
    xMA3 = sma(xMA2, Length)
    xMA4 = sma(xMA3, Length)
    xMA5 = sma(xMA4, Length)
    xMA6 = sma(xMA5, Length)
    xMA7 = sma(xMA6, Length)
    xMA8 = sma(xMA7, Length)
    xMA9 = sma(xMA8, Length)
    xMA10 = sma(xMA9, Length)
    xHH = highest(close, LengthHHLL)
    xLL = lowest(close, LengthHHLL)
    xHHMAs = max(xMA1,max(xMA2,max(xMA3,max(xMA4,max(xMA5,max(xMA6,max(xMA7,max(xMA8,max(xMA9,xMA10)))))))))
    xLLMAs = min(xMA1,min(xMA2,min(xMA3,min(xMA4,min(xMA5,min(xMA6,min(xMA7,min(xMA8,min(xMA9,xMA10)))))))))
    xRBO = 100 * ((close - ((xMA1+xMA2+xMA3+xMA4+xMA5+xMA6+xMA7+xMA8+xMA9+xMA10) / 10)) / (xHH - xLL))
    xRB = 100 * ((xHHMAs - xLLMAs) / (xHH - xLL))
    pos:= iff(xRBO > 0, 1,
           iff(xRBO < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Rainbow Oscillator", 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, "---- Rainbow Oscillator ----")
LengthRO = input(2, minval=1)
LengthHHLL = input(10, minval=2, title="HHV/LLV Lookback")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posRO = RO(LengthRO, LengthHHLL)
pos = iff(posReversal123 == 1 and posRO == 1 , 1,
	   iff(posReversal123 == -1 and posRO == -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 )

더 많은