전략에 따른 절대 가격 오시레이터 트렌드

저자:차오장, 날짜: 2023-09-21 15:27:59
태그:

전반적인 설명

이 전략은 거래 신호를 생성하고 트렌드를 추적하기 위해 절대 가격 오시레이터 (APO) 지표를 사용합니다. APO는 두 개의 EMA와 거래 크로스오버의 차이점을 계산합니다.

전략 논리

  • APO는 더 빠른 EMA와 더 느린 EMA로 구성되어 있으며, 그 사이의 차이를 취합니다.

  • APO가 구매 구역 (디폴트 3) 이상으로 넘으면, 장가가 됩니다. 판매 구역 (디폴트 -3) 아래로 넘으면, 단가가 됩니다.

  • 신호를 반전할 수 있는 옵션 - 판매 상위 크로스, 구매 하위 크로스

  • 곡선은 가격 동력을 보여줍니다.

이것은 지속된 긴/단기 신호에 대한 트렌드 방향을 결정하기 위해 APO를 사용하여 트렌드 다음 전략입니다. 최적화된 매개 변수는 중장기 트렌드를 추적할 수 있습니다.

장점

  • 기본 이동 평균 조합을 사용하여 간단한 구현.

  • APO는 가격 동력과 방향을 측정합니다.

  • 기본 매개 변수는 중장기 지속 신호를 생성하여 과잉 거래를 피합니다.

  • 가격/지표의 오차를 기반으로 트렌드 반전을 감지할 수 있습니다.

위험성

  • 시장에서 잘못된 신호와 위프사에 취약합니다.

  • 지연 신호는 빠른 반전을 놓칠 수 있습니다.

  • 스톱 로즈나 포지션 사이즈가 없고, 리스크 관리도 완전하지 않습니다.

완화:

  • 매개 변수를 최적화하고 각 기기별로 다양한 조합을 테스트합니다.

  • 필터를 추가해서 불안한 조건에서 거래를 피합니다.

  • 스톱 로스를 적용합니다. 예를 들어 트레일 스톱.

더 나은 기회

  • 이상적인 쌍을 찾기 위해 각 기기의 매개 변수 최적화

  • 잘못된 신호를 줄이기 위해 가격 행동이나 부피에 대한 추가 필터.

  • 변동성 또는 계정 %에 기초한 역동적 포지션 크기

  • 트렌드를 따르기 위해 후속 스톱과 같은 수익을 최적화합니다.

  • ML: 성공적 분산 신호의 확률을 평가하기 위한 ML

결론

이 EMA 크로스오버 시스템은 APO를 사용하여 트렌드 추적에 대한 탄탄한 기반을 제공합니다. 매개 변수, 위험 관리 및 필터에서 최적화를 통해 효과적인 정량 전략이 될 수 있습니다. 핵심 개념은 더 이상의 개발에 간단하고 견고합니다.


/*backtest
start: 2022-09-14 00:00:00
end: 2023-09-20 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 20/09/2018
// 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.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Absolute Price Oscillator (APO) Backtest 2.0", shorttitle="APO")
LengthShortEMA = input(10, minval=1)
LengthLongEMA = input(20, minval=1)
BuyZone = input(3, step = 0.01)
SellZone = input(-3, step = 0.01)
reverse = input(false, title="Trade reverse")
hline(BuyZone, color=green, linestyle=line)
hline(SellZone, color=red, linestyle=line)
hline(0, color=gray, linestyle=line)
xPrice = close
xShortEMA = ema(xPrice, LengthShortEMA)
xLongEMA = ema(xPrice, LengthLongEMA)
xAPO = xShortEMA - xLongEMA
pos = iff(xAPO > BuyZone, 1,
       iff(xAPO < SellZone, -1, nz(pos[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)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue )  
plot(xAPO, color=blue, title="APO")

더 많은