반전 리바이벌 오실레이터 지표 조합 전략


생성 날짜: 2023-11-02 16:43:41 마지막으로 수정됨: 2023-11-02 16:43:41
복사: 1 클릭수: 727
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

반전 리바이벌 오실레이터 지표 조합 전략

개요

이 전략은 복합 전략으로, 반전 전략과 부활 진동 지표 전략을 결합하여 더 신뢰할 수 있는 거래 신호를 얻으려는 것이다.

전략 원칙

이 전략은 두 부분으로 구성되어 있습니다.

  1. 역전 전략

역전 전략은 울프 젠센의 책 How I Doubled My Money in the Futures Market에서 나온다. 183쪽. 이 전략은 역전 유형에 속하며, 구체적인 논리는 다음과 같다.

  • 종식 가격이 전날의 종식 가격보다 높을 때, 2일 연속으로, 그리고 9일 느린 스토흐 지표가 50보다 낮을 때, 더 많은 입장을 다.

  • 마감 가격이 전날의 마감 가격보다 낮게 2일 연속으로, 그리고 9일 빠른 스톡 지표가 50보다 높을 때, 상장한다.

  1. 진동 지표 부활 전략

부활 진동 지표는 시장에서 가장 미세한 변동의 차수를 계산하여 그 값은 일반적으로 -1에서 1 사이로 변동한다. 지표 값이 높을수록 상승 추세 또는 하락 추세에 상관없이 트렌딩성이 강하다.

지표가 높은 값에 도달하면 더 많은 것을; 지표가 낮은 값에 도달하면 공백. 이 지표는 일일 거래에 적합하다.

마지막으로, 두 가지 전략 신호가 동방향일 때, 즉 관련 방향의 거래가 진행된다.

우위 분석

  • 반전 전략과 트렌드 전략을 결합하면, 가짜 신호를 필터링하여 거래 신호의 신뢰성을 높일 수 있습니다.

  • 반전 전략은 단기 반전 기회를 포착할 수 있고, 부활 진동 지표 전략은 중장선 트렌드를 포착할 수 있다.

  • Stoch 지표의 매개 변수가 최적화되어 있어, 흔들리는 시장의 가짜 신호를 효과적으로 필터링할 수 있다.

  • 부활 진동 지표는 미세한 시장 변동에 민감하여 추세 전환을 미리 포착할 수 있다.

위험과 해결책

  • 반전 전략은 거대한 트렌드 반전으로 쉽게 삼키기 쉽고, 적절히 조정할 수 있는 매개 변수, 또는 트렌드 전략과 조합하여 사용한다.

  • 지표 전략은 과도한 거래 신호를 생성하기 쉽다. 적절한 수치를 조정하거나 다른 필터 지표 조합과 함께 사용할 수 있다.

  • 두 가지 전략적 신호는 일치하지 않을 수 있으며, 역사 재검토 데이터에 따라 매개 변수를 조정하여 두 가지의 협력을 최적화 할 수 있습니다.

  • 단편적 손실을 통제하기 위해 Stop Loss 전략을 도입할 수 있다.

최적화 방향

  • 다양한 역변수 조합을 테스트하여 최적의 변수를 찾습니다.

  • 다양한 부활 진동 지표 파라미터를 테스트하여 최적의 파라미터를 찾습니다.

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

  • 다른 보조 지표를 추가하여 더 많은 신호를 필터링하십시오.

  • 기계 학습 모델을 추가하여 신호의 정확도를 향상시킵니다.

  • 위험 관리 장치의 도입, 예를 들어, 손해 중지, 포지션 관리 등

요약하다

이 전략은 반전 전략과 부활 진동 지표 전략을 조합하여 두 가지 다른 유형의 전략의 장점을 종합적으로 활용하여 거래 신호 품질을 향상시킬 수 있으며, 재검토에서 더 나은 효과를 나타냅니다. 매개 변수 최적화, 다른 지표 추가, 위험 관리 등의 추가 최적화를 통해이 전략은 더 나은 실장 효과를 얻을 수 있습니다.

전략 소스 코드
/*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 )