Ogee wrote: ↑Fri Nov 19, 2021 9:30 pm

I'm not disputing there is such a thing as 'natural ma' but in the context of it being in a sub window indicator I still suspect it stands for 'normalised'.

NMA is calculated when iNma() function is called, for example in this line :

Code: Select all

` double ma = iNma(price,iTema(price,TemaLength,i,0),Length,i,0);`

The lines of code the you have shown have nothing in common with the NMA itself

PS: The NMA (Natural Moving Average) definition by Jim Sloman :

7 . The Natural Moving Average

Effort* to develop a natural moving average were in the background ol

my mind for a long time. It seemed to me that the simple concept of a

moving average was the most powerful idea ever discovered in the Search

to analyze series ot numbers. Here was something that could summarize,

in die most powerful way, what was happening.

Due the simple moving average had some powerful defects too. One,

it weighed all its time points equally, without adjusting for nearness to the

now moment. And second, an arbitrary constant gets introduced which

radically determines what you see. A 10-day moving average of a market

looks far different than a 200-day moving average.

A big improvement, in my opinion, was the EMA, or exponential

moving average. I don’t know who discovered it, but they did some fine

work. The great insight of the exponential is that the distance itself

between the average and .lie price is always adjusted, in this ease by <he

constant. To take a simple example, if the price moves to 100 and the

EMA is at 90 and the constant is 0.1, then the new EMA becomes 91.

The EMA moved 0.1 of the distance which separated it from the price.

In addition, if we analyse the EMA mathematically, we find that it

gives price points more weight as they get closer to the now moment. 1 lie

exact way in which it does this, of course, is determined by the constant

you supply.

And there’s the rub. Ikcause once again were introducing a constant

which, depending on what we supply, radically alters the “window”

through which we're looking at die market or number series.

To remedy this shortcoming, some fine work hv Clundc and others

lias been done to vary the constant based on the volatility o< the market.

I would now like to add modestly to these el forts.

As always, 1 was looking for something where this adjustment for

volatility would he non-arbitrary in that there would he no introduction

of new constants. And where the adjustment for volatility would not he

programmed in (if die volatility changes this much, change the constant

that much), but rather where the volatility-adjustment would naturally

arise somehow from the market itself.

In calculating the exponential constant, I used the absolute value of

NMR for the numerator, which provides a natural falling-off in influence

as the price moves farther from the now momenr. The denominator

became simply the sum of the (absolute value of the) ols over the period

of rime in which data is supplied for calculating the NMR. If we supply

40 days (or units) of data to calculate the NMR. then we supply 40 days

(or units) of ols for the denominator.

The resulting ratio is then used as the constant in calculating an hMA

in the normal way.

The denominator of that ratio is the sum of the absolute changes in

the natural log of the price. The numerator is also those same changes,

but naturally adjusted (by the differences in the square roots of time) for

the falling away in influence as time goes away from the now moment.

The result, the Natural Moving Average or NMA, automatically

adjusts for volatility without being programmed to do so. and without

introducing any constants.