Skip to content
All library documents

A Faster Linear Weighted Moving Average for Repeated Indicator Calls

Article MQL5 code base

Summary

This short note concerns implementing a linear weighted moving average (LWMA) more efficiently. It says that a common implementation uses loops and becomes slower as the calculation period grows. The author presents an alternative version intended to avoid that slowdown and describes it as suitable for repeated calls through an indicator interface. The post does not include the implementation itself, so readers cannot inspect or reproduce the claimed optimization from this text alone.

The idea is relevant to traders or developers who calculate moving averages across many bars or repeatedly invoke indicators inside a platform. However, the document provides no benchmark, complexity analysis, sample output, or comparison against a reference LWMA calculation. It also does not discuss how the indicator is used in a trading rule. Its contribution is limited to a performance motivation and a claim about a faster implementation, rather than a strategy or validated trading result.

Key ideas

  • A loop-based LWMA implementation can slow down as its calculation period increases.\nThe author describes an alternative implementation intended to reduce this performance cost.\nThe alternative is presented as appropriate for repeated indicator calls.\nNo code, benchmark, or trading application is included in the document.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.