How to code an indicator of an indicator


Category:
0
0

I am interested in seeing how to code an indicator or an indicator.  For the sake of keeping it simple how about a sma of the dm of the dm+ overlayed on just the dm+.

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on December 12, 2020 4:58 pm
91 views
0
Private answer

Your solution is found in the source code of the MACD (and many other built-in chart studies, too numerous to list).

Check these two lines of code taken from the MACD included with Thinkorswim:

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

The first line computes the MACD value. The second line takes that value and computes a moving average of that value.

You will also find examples of this used in the following chart studies:

CCIAverage, DEMA, DMI, StochasticFull, TEMA....

Yep, this sort of thing is quite common. Once you know what to look for you will them everywhere.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 12, 2020 5:28 pm