123 역전 및 프랙탈 카오스 오시레이터의 콤보 전략

저자:차오장, 날짜: 2023-11-02 16:43:41
태그:

img

전반적인 설명

이것은 더 신뢰할 수 있는 거래 신호를 얻기 위해 123 역전 전략과 프랙탈 카오스 오시레이터 전략을 결합 한 콤보 전략입니다.

전략 논리

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

  1. 123 역전 전략

    이 전략은 울프 젠슨의 책 How I Tripled My Money in The Futures Market, 183. 페이지에서 나온다. 이 전략은 역전형 전략이다. 논리는 다음과 같다.

    • 클로즈 가격이 2일 연속으로 이전 클로즈보다 높고, 9일 슬로우 스톡이 50보다 낮을 때 롱으로 이동합니다.

    • 닫기 가격이 2일 연속으로 닫기보다 낮고 9일 빠른 스톡이 50보다 높을 때 짧게 가십시오.

  2. 프랙탈 카오스 오시일레이터 전략

    FCO는 시장에서 가장 미묘한 움직임 사이의 차이를 계산합니다. 그 값은 -1과 1 사이 변동합니다. 값이 높을수록 상승 추세 또는 하락 추세에 관계없이 추세가 강합니다.

    FCO가 높은 수준에 도달 할 때 긴 거. FCO가 낮은 수준에 도달 할 때 짧은 거. 이 지표는 내일 거래에 적합합니다.

양쪽 전략의 신호가 일치하면 그 방향으로 거래가 이루어집니다.

이점 분석

  • 역전과 트렌드 전략을 결합하면 잘못된 신호를 필터링하고 신뢰성을 향상시킵니다.

  • 역전 전략은 단기적 역전 기회를 포착하고, FCO 전략은 중장기적 경향을 포착합니다.

  • 최적화된 스톡 매개 변수들은 범위를 제한하는 시장에서 잘못된 신호를 효과적으로 필터링합니다.

  • FCO는 시장의 미묘한 변동에 민감하며 트렌드 변화를 조기에 감지할 수 있습니다.

위험 과 해결책

  • 역전 전략은 큰 트렌드 역전으로 압도 될 수 있습니다. 매개 변수를 조정하거나 트렌드 전략과 결합합니다.

  • 지표 전략은 과도한 신호를 생성 할 수 있습니다. 매개 변수를 조정하거나 필터링 지표를 추가하십시오.

  • 충돌 신호가 발생할 수 있습니다. 협력을 개선하기 위해 백테스트 결과를 기반으로 매개 변수를 최적화하십시오.

  • 단일 트레이드 손실을 제어하기 위해 스톱 로스를 추가합니다.

최적화 방향

  • 최적을 찾기 위해 다른 역전 파라미터 조합을 테스트합니다.

  • 가장 좋은 것을 찾기 위해 다른 FCO 매개 변수를 테스트합니다.

  • 유전 알고리즘, 무작위 숲 등과 같은 다른 매개 변수 최적화 방법을 시도하십시오.

  • 추가 필터 신호에 더 많은 보조 표시기를 추가하십시오.

  • 신호의 정확성을 높이기 위해 기계 학습 모델을 추가합니다.

  • 스톱 로스, 포지션 사이즈 등 위험 관리 메커니즘을 도입합니다.

요약

이 전략은 포트폴리오 사용을 통해 역전 및 FCO 전략의 장점을 결합하고 신호 품질을 향상시킵니다. 백테스트에서 좋은 성능을 보여줍니다. 매개 변수 조정, 지표 추가, 위험 관리 등과 같은 추가 최적화는 라이브 성능을 향상시킬 수 있습니다. 전반적으로 이것은 연구 및 적용 가치가있는 혁신적인 전략입니다.


/*backtest
start: 2023-10-02 00:00:00
end: 2023-10-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 07/10/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
//   The value of Fractal Chaos Oscillator is calculated as the difference between 
// the most subtle movements of the market. In general, its value moves between 
// -1.000 and 1.000. The higher the value of the Fractal Chaos Oscillator, the 
// more one can say that it follows a certain trend – an increase in prices trend, 
// or a decrease in prices trend.
//
//   Being an indicator expressed in a numeric value, traders say that this is an 
// indicator that puts a value on the trendiness of the markets. When the FCO reaches 
// a high value, they initiate the “buy” operation, contrarily when the FCO reaches a 
// low value, they signal the “sell” action. This is an excellent indicator to use in 
// intra-day trading.
//
// 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

fractalUp(pattern) =>
    p = high[pattern+1]
    okl = 1
    okr = 1
    res = 0.0
	for i = pattern to 1
		okl := iff(high[i] < high[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(high[i] < high[i-1] and okr == 1, 1, 0)
	res := iff(okl == 1 and okr == 1, p, res[1])
    res

fractalDn(pattern) =>
    p = low[pattern+1]
    okl = 1
    okr = 1
    res = 0.0
	for i = pattern to 1
		okl := iff(low[i] > low[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(low[i] > low[i-1] and okr == 1, 1, 0)
	res := iff(okl == 1 and okr == 1, p, res[1])
    res

FCO(Pattern) =>
    pos = 0.0
    xUpper = fractalUp(Pattern) 
    xLower = fractalDn(Pattern)
    xRes = iff(xUpper != xUpper[1], 1, 
             iff(xLower != xLower[1], -1, 0))
    pos := iff(xRes == 1, 1,
             iff(xRes == -1, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Fractal Chaos Oscillator", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Pattern = input(1, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFCO = FCO(Pattern)
pos = iff(posReversal123 == 1 and posFCO == 1 , 1,
	   iff(posReversal123 == -1 and posFCO == -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 )

더 많은