
평평한 자기 적응 채널 가격 돌파 전략은 평평한 자기 적응 이동 평균 ((AMA) 과 자기 적응 채널 범위를 기반으로 구매 및 판매 신호를 판단하는 긴 선 돌파 전략이다. 이 전략은 AMA를 사용하여 현재 가격의 트렌드 방향을 계산하고 동적으로 조정된 채널 범위를 결합하여 가격 돌파 신호를 발견하여 적절한 시간에 구매 및 판매한다.
이 전략의 핵심 지표는 평균 적응 이동 평균 ((AMA) 이며, 가격 추세를 포착하기 위한 AMA의 계산 공식은 다음과 같습니다.
AMA(t) = α(t-1) * P(t) + [1 - α(t-1)] * AMA(t-1)
그 중 P (t) 는 현재 가격이고, α (t) 는 평평한 상수이며, 그 값은 0에서 1 사이의 범위를 갖는다.
SNRT = (P(t) - AMA(t-1)) / AMA(t-1)
이렇게, 가격 변동이 커지면, α(t) 가 커져 AMA가 더 민감하게 가격을 따라하게 한다. 가격 변동이 작아지면, α(t) 가 작아져 AMA가 더 부드럽게 된다.
AMA를 기반으로, 전략은 가격 돌파 신호를 발견하기 위해 적응 채널 범위를 구축합니다. 채널 범위의 상하 트랙은 다음과 같습니다:
상궤: H (t) = (1 + β)*H(t-1)) * AMA(t)
하도: L (t) = (1 - β)*L(t-1)) * AMA(t)
여기서 β는 채널의 폭을 제어하는 조정 가능한 파라미터이다. 마지막으로, 전략은 가격이 위아래 궤도를 돌파하는지 관찰함으로써 거래 신호를 생성한다:
“가격이 올라갈 때 더 많이 해라.
가격 하락을 겪을 때 공백을 뚫고
아니면 빈 창고
이 전략은 다음과 같은 장점을 가지고 있습니다.
일반 이동 평균 대신 AMA를 사용하면 가격 추세를 더 유연하게 잡을 수 있으며 특히 변동성이 높은 시장에 적합합니다.
자기 적응 채널 범위는 동적으로 조정할 수 있으며, 불확실한 상황에서는 채널 폭을 넓히고, 명확한 추세에서는 채널 폭을 좁히고, 가격을 추적할 수 있다.
가격 돌파 거래 신호를 사용하여 트렌드 초기 단계에서 신속하게 잡을 수 있으며 높은 승률을 나타냅니다.
전략적 논리는 간단하고 명확하며, 이해하기 쉽고 구현하기 쉽고, 양적 거래에 적합하다.
이 전략에는 다음과 같은 위험도 있습니다.
AMA 파라미터를 잘못 설정하면 잘못된 가격 트렌드가 발생하거나 잘못된 신호가 발생할 수 있습니다.
beta와 같은 적응 채널 파라미터를 신중하게 설정해야 합니다. 그렇지 않으면 너무 자주 거래하거나 놓치는 경향이 발생할 수 있습니다.
가격 돌파 신호는 가짜 돌파에 속기 쉽기 때문에 더 많은 지표와 함께 필터링해야 합니다.
이 전략은 자금 관리와 손해 방지 장치를 고려하지 않고 손실 위험이 있습니다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
AMA의 α값을 계산하는 방법을 최적화하여 가격 변화에 더 민감하게 만듭니다.
통로 침입 후 추가 확인을 추가하여 가짜 침입이 잘못된 신호를 생성하는 것을 피하십시오.
거래량이나 변동성 지표와 결합하여 필터링을 통해 돌파구가 유효하다는 것을 확인합니다.
수익을 고정하고 위험을 통제하기 위해 추적 스톱 손실 메커니즘을 추가합니다.
자금 관리를 최적화하고, 다양한 자산의 합리적인 포지션 관리를 결정한다.
자동 적응 채널 가격 돌파 전략은 전체적으로 간단하고 실용적인 트렌드 추적 돌파 전략이다. 그것은 유연한 응용을 통해 이동 평균을 자동 적응하여 가격 트렌드를 추적하고, 자동 적응 채널 발견 돌파 신호를 보조한다. 이 전략은 장점이 있지만, 잠재적 인 위험도 존재한다. 매개 변수를 최적화하고, 필터링 조건을 추가하고, 손해 방지 메커니즘을 개선하는 등의 방법으로 전략을 더 안정적으로 만들 수 있다.
/*backtest
start: 2022-10-26 00:00:00
end: 2023-11-01 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// CryptoStatistical - 2019
// AMA Strategy Channel Breakout Strategy from E. Durenard - Professional Automated Trading
// https://www.amazon.com/Professional-Automated-Trading-Theory-Practice/dp/1118129857
strategy(title="[CS] AMA Strategy - Channel Break Out", shorttitle="AMA_ChannelBreakout_Strategy", initial_capital = 1000, overlay=true, pyramiding = 0, calc_on_every_tick=false, calc_on_order_fills=false, commission_type= strategy.commission.percent, commission_value = 0.08, currency=currency.USD)
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(6, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = input(2019, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
testPeriodBackground = input(title="Color Background?", type=input.bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=95)
testPeriod() => true
price = input(title='Price Source:', type=input.source, defval=close)
ama = price
hb = price
lb = price
// Static model parameters
minfactor = 0.
maxfactor = 1.
deviation_max = 1.
deviation_min = 1.
beta_hb = 1.
beta_lb = 1.
snr = 1.
normalized_atan= 0.
alpha = 0.5
// Suggested snr-factor from .5 upto 3.1 by .3 to find best parameter
snrfactor = input(title='SNR Factor:', type=input.float, minval=0.6, maxval=3.3, step=0.3, defval=2.1)
// Sensitivity Lookback search for the best perdiod from 5 to 20
lookback = input(title='Sensitivity Lookback:', type=input.integer, defval=5)
// Suggested Beta from .5 below 4.5 by .3, usually in the range 1.2, 1.5
beta = input(title='Beta:', type=input.float, minval=0.6, maxval=4.5, step=0.3, defval=2.1)
offsetlabel = input(title='Offset Label:', type=input.float, minval=0.001, maxval=0.03, step=0.001, defval=0.001)
// pi/2
pi2 = 1.5707963267948966
// Zero-lag resampled moving average (Durschner nwma)
f_nwma(_src, _period) =>
fast = _period/2
lambda = _period/fast
alpha = lambda * (_period - 1)/(_period - lambda)
average1 = wma(_src,_period)
average2 = wma(average1,fast)
nwma = (1+alpha)*average1 - alpha*average2
ama := alpha[1]*price + (1-alpha[1])*nz(ama[1])
deviation_max := alpha[1]*max((price[0] - price[1])/price[1],0) + (1-alpha[1])*nz(deviation_max[1])
deviation_min := -alpha[1]*min((price[0] - price[1])/price[1],0) + (1-alpha[1])*nz(deviation_min[1])
beta_hb := beta*deviation_max
beta_lb := beta*deviation_min
hb := (1 + beta_hb[1])*ama
lb := (1 - beta_lb[1])*ama
snr := if price > hb
((price - ama[1])/ama[1])/beta_lb
else
if price < lb
-((price - ama[1])/ama[1])/beta_hb
else
0
normalized_atan := (atan(snrfactor*snr) + pi2)/(2*pi2)
alpha := f_nwma(minfactor + (maxfactor - minfactor)*normalized_atan, lookback)
plot(ama, color=color.black)
plot(hb, color=color.green)
plot(lb, color=color.red)
// Buy Condition Var
bc = false
// Sell Condition Var
sc = false
d = color.black
// Buy Condition
if(price > hb)
bc := true
d := color.green
// Sell Condition
if(price < lb)
sc := true
d := color.red
if(testPeriod())
strategy.entry("Long", strategy.long, when = bc)
strategy.entry("Short", strategy.short, when = sc)
alertcondition(bc, title='BuyCondition', message='Buy')
alertcondition(sc, title='SellCondition', message='Sell')
plotshape(title='Buy', series=bc ? price * (1 - offsetlabel) : na, text='A1B', style=shape.labelup, location=location.absolute, color=d, textcolor=color.white, offset=0)
plotshape(title='Sell', series=sc ? price * (1 + offsetlabel) : na, text='A1S', style=shape.labeldown, location=location.absolute, color=d, textcolor=color.white, offset=0)