Unlocking the Inverse Distance Weighted Moving Average (IDWMA) for MetaTrader 4

Mike 2012.02.27 23:42 66 0 0
Attachments

If you're on the lookout for a moving average that offers a fresh perspective on price action, the Inverse Distance Weighted Moving Average (IDWMA) might just be your new best friend. This handy indicator is capable of working across multiple timeframes and offers a unique twist by discounting prices that stray far from the average.

What sets the IDWMA apart? Well, it’s smoother than the classic Simple Moving Average (SMA) yet still tracks price movements similarly to an Exponential Moving Average (EMA) of the same length. I stumbled upon this concept while browsing Wikipedia, and thought it might be beneficial for our trading strategies, so I decided to code it up!

Now, like any moving average, it does come with its quirks. You might notice some overshoot and an initial lag, much like the SMA. However, the IDWMA converges closer to the price than the corresponding EMA, which can be particularly useful in particular market situations. This initial lag can also serve as a handy tool for setting trailing stops or identifying market reversals.

Parameters You Need to Know

The IDWMA comes with four parameters, with the first three aligning closely with the standard moving average settings:

  • MA_Period: The default period is set to 14.
  • MA_Shift: This is set to 0 by default.
  • MA_Price: You can choose various price types (e.g., close, open, high, low, etc.).
  • MA_TF: This allows you to select the chart timeframe, with 0 representing the current chart.
externint MA_Period = 14; // Default Moving Averageexternint MA_Shift  =  0; // Default Moving Averageexternint MA_Price  =  0; // PRICE_CLOSE=0, Open=1, High=2, Low=3, median=4, typical=5, weighter=6externint MA_TF     =  0; // Chart=0, PERIOD_H1...

List
Comments 0