역과 미래 경계선을 통합하는 양적 거래 전략

저자:차오장, 날짜: 2023-12-08 12:00:35
태그:

img

전반적인 설명

이 전략은 123 역전 전략과 미래 경계선 (FLD) 전략을 통합하여 양적 거래 전략을 구현하여 두 전략이 동시에 신호를 생성 할 때 입소 또는 출소하는 것입니다. 주로 지표 선물 시장에 적용되며, 중·단기 보유 거래를 위해 단기 역전 신호와 중·장기 트렌드 신호의 조합에서 기회를 포착합니다.

원칙

123 역전 전략

123 반전 전략은 책에서 유래 How I Tripled My Money in the Futures Market. 닫기 가격이 2 일 연속으로 반전 패턴을 표시하고 9 일 느린 스토카스틱이 50 이하일 때 길어집니다. 닫기 가격이 2 일 연속으로 반전 패턴을 표시하고 9 일 빠른 스토카스틱이 50 이상일 때 짧아집니다.

경계선 전략의 미래 라인업

미래 경계선 (FLD) 전략은 가격 변동의 주기성을 기반으로하는 트렌드를 따르는 전략이다. FLD 라인은 중위, 높은 또는 낮은 가격을 약 반 주기로 미래로 이동함으로써 그려진다. 거래 신호는 가격이 FLD 라인을 넘을 때 생성된다.

이점 분석

이 전략은 반전 및 트렌드 추종 전략을 결합하여 양적 거래의 여러 시간 프레임에서 단기적 반전 기회와 중장기적 트렌드 방향을 포착합니다. 반전 요소는 단기적 이윤 취득 기회를 제공하며, 트렌드 추종 부분은 전체 거래가 트렌드와 일치하여 거래 위험을 효과적으로 제어하도록합니다. 또한 FLD의 적응성 특성으로 전략의 안정성이 향상됩니다.

위험 분석

이 전략의 주요 위험은 역전 신호의 잘못된 파업과 FLD 라인 판단의 오류에서 발생합니다. 전자의 경우 역전 신호를 확인하거나 정확성을 향상시키기 위해 다른 보조 지표를 추가하기 위해 매개 변수를 조정할 수 있습니다. 후자의 경우 FLD가 시장 주기를 더 정확하게 설명하도록 매개 변수를 최적화해야합니다. 또한 주요 트렌드 역전이 발생했을 때 FLD의 오류도 주의해야합니다.

최적화 방향

  1. 신호 필터에 다른 지표를 추가하여 반전 전략을 개선하고 잘못된 파업 가능성을 줄이십시오.
  2. 순환 패턴을 더 잘 설명하기 위해 다른 FLD 매개 변수를 비교합니다.
  3. 단일 손실 위험을 제어하기 위해 스톱 로스 로직을 추가
  4. 다른 제품에서 테스트 매개 변수 효과

결론

이 전략은 중단기 시간 프레임에서 안정적인 수익을 위해 역전 및 추세에 따른 개념을 결합합니다. 신호 정확성, 추세 설명 능력 및 위험 통제 측면에서의 미래 최적화는 매개 변수 우주를 확장하고 안정성을 향상시킬 것입니다.


/*backtest
start: 2022-12-01 00:00:00
end: 2023-12-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 28/08/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
//  An FLD is a line that is plotted on the same scale as the price and is in fact the 
//  price itself displaced to the right (into the future) by (approximately) half the 
//  wavelength of the cycle for which the FLD is plotted. There are three FLD's that can be 
//  plotted for each cycle:
//    An FLD based on the median price.
//    An FLD based on the high price.
//    An FLD based on the low price.
//
// 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


FLD(Period,src) =>
    pos = 0
    pos := iff(src[Period] < close , 1,
             iff(src[Period] > close, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & FLD's - Future Lines of Demarcation", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Period = input(title="Period", defval=40)
src = input(title="Source", type=input.source, defval=close)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFLD = FLD(Period,src)
pos = iff(posReversal123 == 1 and posFLD == 1 , 1,
	   iff(posReversal123 == -1 and posFLD == -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 )

더 많은