CryptoStatistical

[CS] AMA Strategy - Channel Break-Out

"There are various ways to detect trends with moving averages. The moving average is a rolling filter and uptrends are detected when either the price is above the moving average or when the moving average’s slope is positive.

Given that an SMA can be well approximated by a constant-α AMA, it makes a lot of sense to adopt the AMA as the principal representative of this family of indicators. Not only it is potentially flexible in the definition of its effective lookback but it is also recursive. The ability to compute indicators recursively is a very big positive in latency-sensitive applications like high-frequency trading and market-making. From the definition of the AMA, it is easy to derive that AMA > 0 if P(i) > AMA(i-1). This means that the position of the price relative to an AMA dictates its slope and provides a way to determine whether the market is in an uptrend or a downtrend."


You can find this and other very efficient strategies from the same author here:
https://www.amazon.com/Professional-Automated-Trading-Theory-Practice/dp/1118129857

In the following repository you can find this system implemented in lisp:
https://github.com/wzrdsappr/trading-core/blob/master/trading-agents/adaptive-moving-avg-trend-following.lisp

To formalize, define the upside and downside deviations as the same sensitivity moving averages of relative price appreciations and depreciations
from one observation to another:

D+(0) = 0 D+(t) = α(t − 1)max((P(t) − P(t − 1))/P(t − 1)) , 0) + (1 − α(t − 1))D+(t − 1)
D−(0) = 0 D−(t) = −α(t − 1)min((P(t) − P(t − 1))/P(t − 1)) , 0)+ (1 − α(t − 1))D−(t − 1)

The AMA is computed by
AMA(0) = P(0) AMA(t) = α(t − 1)P(t) + (1 − α(t − 1))AMA(t − 1)

And the channels
H(t) = (1 + βH(t − 1))AMA(t) L(t) = (1 − βL(t − 1))AMA(t)

For a scale constant β, the upper and lower channels are defined to be
βH(t) = β D− βL(t) = β D+

The signal-to-noise ratio calculations are state dependent:
SNR(t) = ((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) > H(t)
SNR(t) = −((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) < L(t)
SNR(t) = 0 otherwise.

Finally the overall sensitivity α(t) is determined via the following func-
tion of SNR(t):

α(t) = αmin + (αmax − αmin) ∗ Arctan(γ SNR(t))

Note: I added a moving average to α(t) that could add some lag. You can optimize the indicator by eventually removing it from the computation.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?