다중 요인 반전 거래 전략


생성 날짜: 2023-09-19 21:13:04 마지막으로 수정됨: 2023-09-19 21:13:04
복사: 1 클릭수: 719
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 복합적으로 여러 가지 기술 지표를 사용하여 가격 반전을 판단하며, 다인자 구동 반전 거래 전략에 속한다. 123 형태와 극화 분화 효율 (PFE) 지표를 통합하여, 양쪽이 일치하는 신호를 주면 진입하여 가짜 신호를 효과적으로 필터링하여 거래 승률을 높일 수 있다.

전략 원칙

이 전략은 크게 두 가지로 구성됩니다.

  1. 123 형태 판단: 2일 연속으로 상승한 후 3일째로 하락한 경우, Stochastic의 빠른 선이 느린 선보다 낮아, 구매 신호를 생성한다. 2일 연속으로 하락한 후 3일째로 반발한 경우, Stochastic의 빠른 선이 느린 선보다 높아, 판매 신호를 생성한다.

  2. PFE 지표 판단: PFE가 상한을 초과할 때 과시, PFE가 하한을 초과할 때 과시.

123 형태와 PFE 지표가 일치하는 신호를 생성할 때만 진입한다. 둘 다 일치하지 않을 때, 공백을 유지한다.

123 형태는 잠재적인 반전점을 식별할 수 있다. PFE는 트렌드를 판단하는 효율성을 높여서, 가짜 돌파구를 쫓는 것을 피한다. 이 둘을 결합하면 판단의 정확도를 높여서, 다중 인자 검증의 효과를 얻을 수 있다.

전략적 이점

  • 123 형태와 PFE 지표가 상호 검증하여 가짜 신호를 줄입니다.
  • PFE 지표의 이론적 기반이 튼튼하여 가격 효율성에 대한 판단이 효과적이다.
  • 다중 요소 구동, 판단의 정확성 향상
  • 역동성과 트렌드 지표를 결합한 전략적 유연성
  • 사용자 정의 가능한 매개 변수

전략적 위험과 대응

  • 개별적인 요소가 잘못된 신호를 보낼 수 있습니다.
  • 인자 설정은 지속적으로 최적화 및 조정해야 합니다.
  • 지분 보유 기간이 짧고, 손실이 자주 발생할 수 있습니다.

어떻게 대처해야 할까요?

  1. 검증 요소를 늘리고 정확도를 높여라
  2. 변수 구성을 최적화하고 stableness를 향상
  3. 자동 최적화 방법을 사용하여 최적의 매개 변수를 찾습니다.
  4. 인사를 중지하거나 이동 중지 설정

전략 최적화 방향

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

  1. 변동성 기반의 스톱 손실 설정을 추가합니다.
  2. 기계 학습과 같은 방법을 사용하여 모든 매개 변수를 자동으로 최적화합니다.
  3. 트렌드가 강할 때 반전 거래의 빈도를 낮추는 방법
  4. 시장의 변동성에 대한 적응 지표와 결합된 포지션 유지
  5. 다른 전략과 결합하여 위험을 분산하고 전체 수익률을 높여줍니다.

요약하다

이 전략은 여러 요인을 결합하여 가격 반전점을 판단하고, 이론적 근거가 있으며, 쉽게 실행할 수 있다. 단일 지표에 비해 판단 정확도를 높이기 위해 여러 요인을 동원하는, 비교적 안정적인 반전 거래 전략이다. 파라미터 최적화, 손해 관리, 조합과 같은 방법을 통해 전략 효과를 더욱 강화할 수 있다.

전략 소스 코드
/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-13 08:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 16/04/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 Polarized Fractal Efficiency (PFE) indicator measures the efficiency 
// of price movements by drawing on concepts from fractal geometry and chaos 
// theory. The more linear and efficient the price movement, the shorter the 
// distance the prices must travel between two points and thus the more efficient 
// the price movement.
//
// 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


PFE(Length,LengthEMA,BuyBand,SellBand) =>
    pos = 0.0
    PFE = sqrt(pow(close - close[Length], 2) + 100)
    C2C = sum(sqrt(pow((close - close[1]), 2) + 1), Length)
    xFracEff = iff(close - close[Length] > 0,  round((PFE / C2C) * 100) , round(-(PFE / C2C) * 100))
    xEMA = ema(xFracEff, LengthEMA)
    pos := iff(xEMA < SellBand, -1,
    	      iff(xEMA > BuyBand, 1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & PFE (Polarized Fractal Efficiency)", 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, "---- PFE ----")
LengthPFE = input(9, minval=1)
LengthEMA = input(5, minval=1)
BuyBand = input(50, step = 0.1)
SellBand = input(-50, step = 0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPFE = PFE(LengthPFE,LengthEMA,BuyBand,SellBand)
pos = iff(posReversal123 == 1 and posPFE == 1 , 1,
	   iff(posReversal123 == -1 and posPFE == -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 )