Download MetaTrader 5

Applying one indicator to another

To add comments, please log in or register
Dave Hughes
18
Dave Hughes  

I am trying to use a custom indicator HMA to smooth the line of another indicator. I have found a couple of different implementations of HMA in Codebase: one is based on SmoothAlgorithms.mqh

(the code is at https://www.mql5.com/en/code/549), and the other uses a function iLWMA (on buffer), which is in the same file as the hma indicator (https://www.mql5.com/en/code/135). Both HMA's work on the chart. However, if I use the HMA based on SmoothAlgorithms.mqh to smooth , for example, RSI, it works.

Here is the code I use to create the handles: 

 RSIHandle=iCustom(_Symbol,PERIOD_CURRENT,"RSI",RSI_Period);

 HmaHandle = iCustom(NULL, 0, "hma", MA_Period, RSIHandle);

The other hma based on iLWMA still outputs an HTML line instead of a smoothed RSI line.

I would appreciate it if someone, who is more experienced with mql5 could take a look at the code of those indicators using the links I provided and would explain why the hma based on the iLWMA on buffer function fails to smooth another indicator provided as the last argument to iCustom.

Hull Moving Average (HMA)
Hull Moving Average (HMA)
  • votes: 21
  • 2011.11.09
  • Nikolay Kositsin
  • www.mql5.com
Hull Moving Average (HMA) that can change its color.
To add comments, please log in or register