듀얼 지표 반전 추세 추적 전략


생성 날짜: 2024-02-01 10:55:30 마지막으로 수정됨: 2024-02-01 10:55:30
복사: 0 클릭수: 676
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

듀얼 지표 반전 추세 추적 전략

개요

이 전략은 이동 평균 지표와 시장 거래 편의 지표의 두 지표의 신호를 결합하여 가격 반향을 판단 할 때 구매 또는 판매 작업을 수행하는 역전형 거래 전략에 속한다.

전략 원칙

이 전략은 두 가지 지표를 사용하여 신호 판단을 한다. 첫 번째 지표는 이동 평균 지표이며, 특히 무작위 지표의 빠른 선과 느린 선의 조합이다. 가격이 2 일 연속으로 하락하면서 빠른 선이 느린 선보다 높을 때 판매 신호가 발생하며, 가격이 2 일 연속으로 상승하면서 빠른 선이 느린 선보다 낮을 때 구매 신호가 발생한다. 이렇게 가격 반전과 무작위 지표의 빠른 느린 선 위치 관계를 판단하여 가격이 반전될 수있는 시간을 예측한다.

두 번째 지표는 시장 거래 편의 지수이다. 이 지수는 가격 변동 범위와 거래량과의 관계를 계산하여 시장의 유동성과 가격 운용의 효율성을 판단한다. 지수의 상승은 시장 거래가 순조롭고 운영 효율이 높다는 것을 나타냅니다. 추세 상황으로 판단 할 수 있습니다. 지수의 하락은 시장 유동성의 변동, 운영 효율이 감소하여 상회 변동 상황에 들어갈 수 있습니다.

이 전략은 두 지표의 판단 논리를 결합하여, 두 지표가 동시에 구매 또는 판매 신호를 발송할 때, 각각 구매 및 판매 작업을 발생한다.

전략적 이점

  • 이중 지표 확인을 통해 신호 정확도를 높이고, 가짜 신호를 피할 수 있다.
  • 역전 지표와 트렌드 판단 지표의 조합으로, 역전과 동시에 큰 트렌드를 판단할 수 있으며, 역전 조작을 피할 수 있다.
  • 수시로 요리를 할 필요가 없어서 사람의 개입이 줄어들었습니다.

위험과 해결책

  • 만약 시장이 장기간 단방향으로 상승하거나 하락한다면, 역전 기회를 잡기 어렵고, 시장에 진입할 수 없습니다.

  • 구매 및 판매 기회를 높이기 위해 반전 지표의 매개 변수를 적절하게 느슨하게 할 수 있습니다.

  • 트렌드를 추적하여 더 많은 수익을 얻을 수 있습니다.

  • 역전 신호가 오류로 인해 전략이 실패할 수 있습니다.

  • 지표 매개 변수를 최적화하거나 확인 주기를 늘려서 가짜 신호를 줄일 수 있다.

최적화 방향

  • 더 많은 변수 조합을 테스트하여 최적의 지표 변수를 찾을 수 있습니다.
  • 역전 지표를 추가하거나 변경하여 다른 지표의 역전 효과를 테스트할 수 있습니다.
  • 단독 손실을 통제할 수 있는 손실을 막는 전략을 추가할 수 있습니다.
  • 기계 학습 알고리즘과 결합하여 빅 데이터를 사용하여 더 정확한 역전 모형을 훈련시킬 수 있습니다.

요약하다

이 전략은 반전 지표와 트렌드 판단 지표를 결합하여 가격 반전 예보가 발생했을 때 진입하면서 큰 트렌드를 판단하고 역동작전을 피한다. 쌍 지표 상호증명으로 가짜 신호를 효과적으로 줄일 수 있다. 그러나 전략은 시장의 일방적인 상황이 존재할 때 수익 기회가 없으며 반전 신호를 잘못 판단할 위험도 있다. 파라미터 최적화, 손해 중지 전략, 지표 업그레이드 및 기계 학습 등의 방법으로 추가적으로 최적화 할 수 있다.

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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 02/02/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
// The Market Facilitation Index is an indicator that relates price range to 
// volume and measures the efficency of price movement. Use the indicator to 
// determine if the market is trending. If the Market Facilitation Index increased, 
// then the market is facilitating trade and is more efficient, implying that the 
// market is trending. If the Market Facilitation Index decreased, then the market 
// is becoming less efficient, which may indicate a trading range is developing that 
// may be a trend reversal.
//
// 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


MFI(BuyZone,SellZone) =>
    pos = 0.0
    xmyVol = volume
    xmyhigh = high
    xmylow = low
    nRes = (xmyhigh - xmylow) / xmyVol * 10000
    pos := iff(nRes > BuyZone, 1,
             iff(nRes < SellZone, -1, nz(pos[1], 0)))
    pos

strategy(title="Combo Backtest 123 Reversal & Market Facilitation Index", 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, "---- MFI ----")
SellZone = input(6.2, minval=0.01, step = 0.01)
BuyZone = input(1, minval=0.01, step = 0.01)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posMFI = MFI(BuyZone,SellZone)
pos = iff(posReversal123 == 1 and posMFI == 1 , 1,
	   iff(posReversal123 == -1 and posMFI == -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 )