To use a handle when using iMA (or another tecnical indicator function) MQL5

 
 Hello MQL5 members,
I hope you are well.


I have a very specific question
When working with the functions of technical indicators such as iMA or iCCI, and some others, we can choose, according to the documentation, between APPLIED_PRICE or the handle of another indicator.

Working with the appliedPrice is simple, since there is the enumerator that allows us to choose between the main ones (OHLC and some others).

The question I have is about working it instead of with the appliedprice, with a handler: if, for example, I have a handle for an indicator that has more than one index, such as Heiken ashi (which has 4 indexes)
 (or Gator that has 2 indices) ¿How do I specify to iMA that I want to work with the heiken hashi handle, but with the index 3?

Has anyone worked it that way?
How do I specify what the buffer is for that indicator that I put as a data source?
 
Miguel Antonio Rojas Martinez: When working with the functions of technical indicators such as iMA or iCCI, and some others, we can choose, according to the documentation, between APPLIED_PRICE or the handle of another indicator. Working with the appliedPrice is simple, since there is the enumerator that allows us to choose between the main ones (OHLC and some others). The question I have is about working it instead of with the appliedprice, with a handler: if, for example, I have a handle for an indicator that has more than one index, such as Heiken ashi (which has 4 indexes) (or Gator that has 2 indices) ¿How do I specify to iMA that I want to work with the heiken hashi handle, but with the index 3? Has anyone worked it that way? How do I specify what the buffer is for that indicator that I put as a data source?

When using the indicator handle for the applied_price parameter, then only the first plot buffer can be used as a source of data.

This has been discussed before, so please remember to run a search first before you post a question.

Forum on trading, automated trading systems and testing trading strategies

Using Moving Avereage with custom ENUM_APPLIED_PRICE variable for Heiken Ashi based MA calulation

Fernando Carreiro, 2023.10.25 14:51

Usually the Heiken Ashi is a multi-buffer indicator displayed as candles plot, and as such, cannot be used as the "applied price" for another indicator.

Forum on trading, automated trading systems and testing trading strategies

how to read MACD indicator data when applied to renko chart

Fernando Carreiro, 2023.10.27 15:44

The Renko indicator is usually a multi-buffer indicator displayed as histogram or candles plot, and as such, cannot be used as the "applied price" for another indicator.

The solution is to either calculate the MACD yourself in the code or to use a Renko generator that produces a Custom Symbol and then apply the MACD to it instead.

Forum on trading, automated trading systems and testing trading strategies

How to code Moving Average applied on Bollinger Bands

Fernando Carreiro, 2023.10.11 22:34

To summarise the issue ...

Currently MQL5 does not offer a method to redirect secondary plots to the "applied price" parameter of an indicator function. It only works with the primary plot.

Possible work-arounds (can't be classified as solutions) ...

  • To collect the data from the secondary plots via the CopyBuffer function and then apply a moving average using the functions in in "MovingAverages.mqh" (for the moving average example).
  • To break-down the calculations of the original multi-plot indicator, and then use the "applied price" method on the elementary indicator functions.

Also, neither of the above two work-around are ideal, or efficient or even generic.

There may be other work-arounds that have not yet been proposed or discussed.

 

Thank you very much @Fernando Carreiro   for the quick answer

I understand then that to obtain the indicators with a different data source, I must use different functions than the official ones.

But the idea of being able to set this option directly from MQL5 should also be explored. I hope they see it and consider implementing it, since it is not limited to working with the main series, but with more.

Thanks!!!

 
Miguel Antonio Rojas Martinez #: I understand then that to obtain the indicators with a different data source, I must use different functions than the official ones. But the idea of being able to set this option directly from MQL5 should also be explored. I hope they see it and consider implementing it, since it is not limited to working with the main series, but with more.

I highly doubt that they will change it. This is how it works in the user interface (both on MT4 and MT5) when you place an indicator onto another indicator and choose it as the data source.

The MQL5 code version is just inherited from that user interface functionality, so it will not change until they make a totally new user interface.