龙听期货论坛's Archiver

龙听 发表于 2020-11-28 07:47

Simple length adjusting weighted moving average

**** Hidden Message *****

龙听 发表于 2020-11-28 07:47

You can see that another variable has been added which is a weighted moving average and the trick here is to replace the usual field of length with the algorithm monitor which is adjusting the length applied.

Code tricks to try

If you plot a 20 period weighted average next to it on the subgraph one. You can see how the code above length changing average is slower at some period and faster in other periods.

The above indicator is place in subgraph no1 overlayed with the price. Example code no4 is placed in sub 2.

You can observe the length changing algorithm in action and see how it affects the speed of the weighted average.

页: [1]