MovingAverages.mqh Part I by Wiliam210

MovingAverages.mqh Part I by Wiliam210

Good morning.

If this code malfunctions for whatever reasons, forgetting or MQL5 upgrades, let me know so I can correct it, thank you

You can find all my indicator codes in CodeBase or the Marketplace, free or purchasable, by searching for “William210”.

What is SimpleMA, ExponentialMA, SmoothedMA, LinearWeightedMA?

Smoothing refers to the action of making data fluctuations smoother or less volatile.

It is a technique used to eliminate sudden and unpredictable variations in data series, thereby creating a form of security for investors.

This can help identify underlying trends more clearly.

An investment horizon can be associated with each smoothing


Simple Moving Average (SMA) is the calculation of the arithmetic average of a defined number of values.


The Exponential Moving Average (EMA) is an indicator that gives more weight to recent values.

It is preferred by traders who look for recent price changes of an asset.


The Smoothed Moving Average is a moving average that gives equal importance to all price values.

It is generally used to identify long-term trends.


Linear Weighted Moving Average assigns greater weight to recent values ​​by multiplying each price value by a weight that increases linearly.

This allows you to react more quickly to price changes.

Why this code?

I wanted to write simple and easy to use codes.

Whether you’re new to coding, or need basic code to scale quickly,

This should help you, as it helps me with my own codes.

These codes use the native library that Metaquotes makes available to us in MovingAverages.mqh, i.e.

SimpleMA(), ExponentialMA(), SmoothedMA(), LinearWeightedMA

I’ll do the others, SimpleMAOnBuffer(), ExponentialMAOnBuffer(), LinearWeightedMAOnBuffer() and SmoothedMAOnBuffer(), another day

May this code help you

Don’t forget to put a star and ask me as a friend to be the first to be notified when my code is published in codebase or the marketplace

I wrote other simple codes in CodeBase:

I offer many of these indicators in the Marketplace, search for me “William210”

Adaptative moving average using iama()

Adx using iadx()

Alligator using alligator()

ATR using iatr() 

The ATR is very useful for other indicators, such as SuperTrend which I offer in the marketplace

Awesome oscillator without iao()

Bands bollinger using ibands()

Donchian channel

Envelopes using ienvelopes()

Ishimoku using iishimoku()

Keltener channel

MACD using  imacd()

Momentum using iMomentum()

Moving average using ima()
I offer many multi-timeframe smoothing options in the marketplace.

Simple average => EMA, SMA, EMA, SMMA, LWMA

Volume-weighted averages, VWMA, VEMA

RSI, with or not irsi()

Stochastic using  istochastic()

If you have code ideas to help or serve as a basis, request it on this thread

MovingAverages.mqh Part I by Wiliam210

Share Your Valuable Opinions