두 배의 확신 가격 오스실레이션 양자 전략

저자:차오장, 날짜: 2024-02-18 10:10:16
태그:

img

전반적인 설명

이 전략의 주요 아이디어는 123 역전 전략과 절대 가격 오시레이터 지표를 결합하여 통합 신호를 얻는 것입니다. 구체적으로, 두 하위 전략이 긴 신호를 발산하면 최종 전략 신호는 1 (장기); 둘 다 짧은 신호를 발산하면 최종 신호는 -1 (단기); 신호가 일관성이 없다면 최종 신호는 0 (운동이 없습니다).

원칙

첫째, 123 리버스 전략의 원칙은: 닫기 가격이 전날의 닫기보다 낮고 스토카스틱 오시레이터가 과잉 매수 라인 아래에 있다면, 긴 거리로 가십시오. 닫기 가격이 전날의 닫기보다 높고 스토카스틱 오시레이터가 과잉 매수 라인 위에 있다면, 짧은 거리로 가십시오.

둘째, 절대 가격 오시레이터는 두 개의 기하급수적인 이동 평균 사이의 차이를 표시합니다. 긍정적 값은 상승 추세를 나타냅니다. 부정적인 값은 하락 추세를 나타냅니다.

마지막으로 이 전략은 두 부전략의 신호를 결합합니다. 즉 신호가 일관성있는 경우 신호를 따르고 그렇지 않으면 작동하지 않습니다.

이점 분석

이 전략은 단기 반전 신호와 중장기 트렌드 신호를 종합적으로 고려하여 전환점을 효과적으로 식별 할 수 있습니다. 123 반전 또는 APO만을 사용하는 것과 비교하면 이 전략은 신호의 신뢰성을 크게 향상시키고 잘못된 신호를 줄일 수 있습니다.

또한, 이 전략은 시장에 의존하는 대신 여러 가지 기술적 지표를 사용하여 시장을 포괄적으로 판단합니다. 이것은 하나의 지표의 실패로 인한 잘못된 판단을 피합니다.

위험 분석

가장 큰 위험은 123 역전 및 APO가 충돌 신호를 방출 할 때입니다. 그러한 경우 운영자는 경험에 따라 어느 신호가 더 신뢰할 수 있는지 판단해야합니다. 잘못된 판단은 거래 기회 또는 손실을 잃을 수 있습니다.

또한 급격한 시장 변화는 두 하위 전략의 신호를 동시에 무효화 할 수 있습니다. 거래자는 시장에 중대한 영향을 미치는 이벤트를 모니터링하고 필요한 경우 전략을 중단해야합니다.

최적화

가능한 최적화 방향:

  1. 더 신뢰할 수 있는 신호를 위해 하위 전략 매개 변수를 최적화하십시오. 예를 들어 이동 평균 기간.

  2. 투표 메커니즘을 형성하기 위해 다른 보조 지표를 추가하십시오. 여러 지표에서 일관된 신호는 더 신뢰할 수 있습니다.

  3. 스톱 로스 전략을 추가하십시오. 불리한 가격 움직임에 대한 적절한 스톱 로스는 추가 손실을 피할 수 있습니다.

  4. 역사적인 백테스팅을 기반으로 엔트리 및 스톱 로스 레벨을 최적화합니다.

결론

이 전략은 시장을 판단하기 위해 여러 가지 기술적 지표를 결합하여 단일 지표 의존성 위험을 어느 정도 피하고 신호 정확도를 향상시킵니다. 투자자의 요구 사항에 따라 최적화 할 여지가 있습니다. 전반적으로, 두 배 확신 가격 오스실레이션 양 전략은 신뢰할 수있는 거래 신호를 제공하며 추가 연구가 가치가 있습니다.


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 22/04/2019
// This is combo strategies for get 
// a cumulative signal. Result signal will return 1 if two strategies 
// is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
//
// 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.
//
// Secon strategy
// The Absolute Price Oscillator displays the difference between two exponential 
// moving averages of a security's price and is expressed as an absolute value.
// How this indicator works
//    APO crossing above zero is considered bullish, while crossing below zero is bearish.
//    A positive indicator value indicates an upward movement, while negative readings 
//      signal a downward trend.
//    Divergences form when a new high or low in price is not confirmed by the Absolute Price 
//      Oscillator (APO). A bullish divergence forms when price make a lower low, but the APO 
//      forms a higher low. This indicates less downward momentum that could foreshadow a bullish 
//      reversal. A bearish divergence forms when price makes a higher high, but the APO forms a 
//      lower high. This shows less upward momentum that could foreshadow a bearish 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

AbsolutePriceOscillator(LengthShortEMA, LengthLongEMA) =>
    xPrice = close
    xShortEMA = ema(xPrice, LengthShortEMA)
    xLongEMA = ema(xPrice, LengthLongEMA)
    xAPO = xShortEMA - xLongEMA
    pos = 0.0    
    pos := iff(xAPO > 0, 1,
           iff(xAPO < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal and Absolute Price Oscillator (APO)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
LengthShortEMA = input(10, minval=1)
LengthLongEMA = input(20, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posAbsolutePriceOscillator = AbsolutePriceOscillator(LengthShortEMA, LengthLongEMA)
pos = iff(posReversal123 == 1 and posAbsolutePriceOscillator == 1 , 1,
	   iff(posReversal123 == -1 and posAbsolutePriceOscillator == -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 ? red: possig == 1 ? green : blue ) 

더 많은