Given that an 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:
In the following repository you can find this system implemented in 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:
(t) = ((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) > H(t)
(t) = −((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) < L(t)
(t) = 0 otherwise.
Finally the overall sensitivity α(t) is determined via the following func-
tion of (t):
α(t) = αmin + (αmax − αmin) ∗ Arctan(γ (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.
Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.