이 전략은 절대 가격 진동기 ((APO) 지표를 이용하여 거래 신호를 생성하여 트렌드 추적 거래를 구현한다. APO 지표는 두 개의 다른 기간의 지수 이동 평균의 차이를 계산하여 오실레이터를 받으며, 그 값에 따라 상부 또는 하부 상부 여부를 다듬는다.
APO 지표는 단기 및 장기 EMA로 구성되어 있으며, 이 둘의 차이를 계산한다.
APO 상에서 구매 구역 (기본 3) 에 들어갈 때 더 많이 하고, APO 아래에서 판매 구역 (기본 3) 에 들어갈 때 비어 있다.
선택적으로 반전 신호, APO 상단 착용 시 공백을 하고, 하단 착용 시 더 많은 것을 한다.
지표 곡선은 가격의 움직임을 나타내고, 형성된 트렌드 반전의 신호를 찾을 수 있다.
이 전략은 트렌드 추적 전략에 속하며, APO 지표를 사용하여 가격 트렌드 방향을 결정하고, 지속적인 다중 하위권 신호를 생성한다. 지표 매개 변수가 최적화되면 큰 트렌드의 중간 움직임을 추적할 수 있다.
간단한 이동 평균 지표 조합을 사용하여 쉽게 구현할 수 있습니다.
가격의 움직임과 방향을 APO 지표로 판단하십시오.
기본 변수는 중기 지속 신호를 생성하여 과도한 거래를 방지한다.
이 경우 APO와 동향을 전환할 수 있는 기회를 찾을 수 있다.
위조시장에서는 잘못된 신호와 휘프사우가 발생하기 쉽다.
이 경우, 빠른 회전을 놓칠 수 있습니다.
하지만, 이 경우, 그 위험의 통제는 완벽하지 않습니다.
위험 관리:
최적화 매개 변수, 다양한 품종에 적합한 매개 변수 조합을 테스트한다.
다른 필터를 추가하여 불안한 시장에서 거래하는 것을 피하십시오.
Stop Loss Strategies을 설정하고, 예를 들어, Stop Loss을 추적합니다.
각각의 거래 품종에 대해 개별적으로 파라미터를 최적화하여 최적의 파라미터 쌍을 찾습니다.
가격이나 거래량과 같은 필터링 조건을 높여서 가짜 신호를 줄여라.
변동률 또는 잔액 비율에 따라 역동적인 포지션 관리를 한다.
트렌드 추적 스톱을 설정하여 스톱 방식을 최적화하십시오.
기계 학습 알고리즘을 적용하여 지표가 신호에서 벗어난 성공률을 판단한다.
이 전략은 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")