모멘텀 오시레이터 및 123 패턴 전략

저자:차오장, 날짜: 2024-01-25 14:27:29
태그:

img

전반적인 설명

이 전략은 모멘텀 오시레이터 인덱스와 123 패턴을 결합하여 수익성을 향상시키기 위해 누적 거래 신호로 만듭니다. 모멘텀 오시레이터는 시장 변동성을 추적하고 단기 트렌드를 포착하기 위해 RSI 매개 변수를 조정합니다. 123 패턴은 단기간에 사소한 가격의 최고와 최저를 식별하여 무역 신호를 형성합니다. 두 전략의 조합은 전략이 다른 시장 환경에서 성능을 유지할 수 있습니다.

전략 논리

123 패턴

123 패턴은 세 단계로 구성됩니다. 첫째, 가격은 2 일 연속으로 하락합니다. 둘째, 가격은 다음 2 일 동안 상승합니다. 마지막으로, 가격은 셋째 날에 다시 하락합니다. 이 패턴에 따르면, 우리는 두 번째 단계에서 가격이 상승 할 때 긴 포지션을 설정하고, 세 번째 단계에서 가격이 다시 떨어지면 짧은 포지션을 결정할 수 있습니다.

구체적으로, 닫기 가격이 2 일 연속 하락 후 2 일 연속 닫기보다 높고, 9 일 스토카스틱 슬로우가 50 미만인 경우, 그것은 구매 신호입니다. 닫기 가격이 2 일 연속 상승 후 2 일 연속 닫기보다 낮고, 9 일 스토카스틱 패스트가 50 미만인 경우, 그것은 판매 신호입니다.

임멘텀 오시일레이터

모멘텀 오시일레이터는 RSI와 비슷하게 구성되어 있으며, 주요 차이점은 모멘텀 오시일레이터의 변동 기간입니다. 기간의 수는 최근의 가격 변동성에 달려 있습니다. 높은 변동성은 짧은 기간으로 이어지며 지표를 더 민감하게 만듭니다. 안정적인 가격은 잘못된 신호를 줄이기 위해 더 긴 기간으로 이어집니다.

계산 공식은 다음과 같습니다.

DMI = RSI(DTime)  

Where:  
DTime = 14 / 10-day SMA of standard deviation of close over past 5 days

RSI와 동일한 과잉 구매/ 과잉 판매 기준을 공유합니다.

과잉 매수: DMI > 30 과잉 판매: DMI < 70

DMI가 이 임계치를 넘으면 구매 및 판매 신호가 생성됩니다.

이점 분석

  1. 123 패턴은 간단하고 효과적입니다. 트렌드에 반대하는 입장을 피하면서 소규모 바닥에 들어가고 소규모 정상에 빠져 나가는 단기 역전 패턴을 사용합니다.

  2. 모멘텀 오시레이터는 더 민감합니다. 변동 기간으로 시장에 적응하고 높은 변동성에서도 전환점을 적시에 파악 할 수 있습니다.

  3. 두 전략 모두 잘못된 신호를 효과적으로 필터링하는 데 도움이 됩니다. 123 신호가 발생했을 때 시장 맥락에 대한 DMI를 확인하면 트렌드에 반대하는 거래에서 손실을 줄일 수 있습니다.

  4. 두 전략의 강점을 결합합니다. 123 패턴과 함께 DMI를 필터로 사용하는 것은 시스템의 안정성을 크게 향상시킵니다.

위험 분석

  1. 신호가 흔들리는 경향이 있습니다. DMI와 123 패턴 모두 가격이 역전되는 대신 일시적으로 변동할 때 잘못된 신호를 생성할 수 있습니다.

  2. 잠재적으로 높은 거래 주파수. DMI의 변동 기간은 시장 소음에 매우 민감하게 만듭니다. 매개 변수는 거래 주파수를 제어하기 위해 적절한 조정이 필요합니다.

  3. 123 패턴은 중장기 트렌드 기회를 놓칠 수 있습니다. 그것은 주로 단기 반전을 포착하고 중장기 트렌드에서 지속적으로 이익을 얻을 수 없습니다.

  4. 최대 거래를 제한해야 합니다. 너무 많은 거래는 높은 수수료와 미끄러짐 비용을 초래할 수 있습니다.

최적화 방향

  1. DMI 매개 변수를 최적화하고, 다양한 RSI 기간과 임계값을 테스트하여 최적의 조합을 찾을 수 있습니다.

  2. 123 패턴 필터를 최적화합니다. 다른 스톡 매개 변수나 MACD 같은 필터를 테스트할 수 있습니다.

  3. 스톱 로스 메커니즘을 추가합니다. 적절한 스톱 로스 크기는 손실 트레이드에 대한 하락을 제한하는 데 도움이됩니다.

  4. 위치 사이즈링 규칙을 추가합니다. 고정된 양 또는 고정된 분자 위치 사이즈링은 위험 통제를 향상시킵니다.

결론

이 전략은 트레이드 신호 성능을 향상시키기 위해 모멘텀 오시일레이터와 123 패턴의 분석을 결합합니다. 그러나 단일 전략은 변화하는 시장 조건에 완벽하게 적응 할 수 없습니다. 투자자는 위험을 제어하고 실시간 결과에 기반한 매개 변수를 지속적으로 백테스트하고 업데이트하여 수익성을 유지할 수 있습니다.


/*backtest
start: 2024-01-17 00:00:00
end: 2024-01-24 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 18/03/2020
// 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 Dynamic Momentum Index indicator. The Dynamic Momentum 
// Index (DMI) was developed by Tushar Chande and Stanley Kroll. The indicator 
// is covered in detail in their book The New Technical Trader.
// The DMI is identical to Welles Wilder`s Relative Strength Index except the 
// number of periods is variable rather than fixed. The variability of the time 
// periods used in the DMI is controlled by the recent volatility of prices. 
// The more volatile the prices, the more sensitive the DMI is to price changes. 
// In other words, the DMI will use more time periods during quiet markets, and 
// less during active markets. The maximum time periods the DMI can reach is 30 
// and the minimum is 3. This calculation method is similar to the Variable 
// Moving Average, also developed by Tushar Chande.
// The advantage of using a variable length time period when calculating the RSI 
// is that it overcomes the negative effects of smoothing, which often obscure short-term moves.
// The volatility index used in controlling the time periods in the DMI is based 
// on a calculation using a five period standard deviation and a ten period average 
// of the standard deviation.
//
// 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

DMI(RSILen, BuyZone,SellZone,UpLimit,LoLimit) =>
    pos = 0
    xStdDev = stdev(close, 5) 
    xSMAStdDev = sma(xStdDev, 10)
    DTime = round(14 / xSMAStdDev - 0.5)
    xDMI = iff(DTime > UpLimit, UpLimit,
             iff(DTime < LoLimit, LoLimit, DTime))
    xRSI = rsi(xDMI, RSILen)
    pos := iff(xRSI > BuyZone, 1,
             iff(xRSI < SellZone, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Dynamic Momentum Index", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
RSILen = input(14, minval=1)
BuyZone = input(30, minval=1)
SellZone = input(70, minval=1)
UpLimit = input(30, minval=1)
LoLimit = input(5, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posDMI = DMI(RSILen, BuyZone,SellZone,UpLimit,LoLimit)
pos = iff(posReversal123 == 1 and posDMI == 1 , 1,
	   iff(posReversal123 == -1 and posDMI == -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 )

더 많은