Download MetaTrader 5

Help about MA of another MA!

To add comments, please log in or register
How to buy a product in MetaTrader AppStore? Read the article!
Chronis Boulanikis
2550
Chronis Boulanikis 2014.04.03 14:17 

Hello.

Pls if somebody can help me:

On MQL5 we use handles and we can calculate an MA of another MA:

   //set handler for used indicators
   emaA = iMA(NULL, MA_TF, EmaPeriod1, 0, MODE_EMA, PRICE_WEIGHTED);
   emaA2 = iMA(NULL, MA_TF, EmaPeriod2, 0, MODE_EMA, emaA);

On MQL4 i try this:

         emaA = iMA(NULL, MA_TF, EmaPeriod1, 0, MODE_EMA, PRICE_WEIGHTED, 0); emaAx = NormalizeDouble(emaA, _digits);
         emaA2 = iMA(NULL, MA_TF, EmaPeriod2, 0, MODE_EMA, emaA, 0); emaA2x = NormalizeDouble(emaA2, _digits);
and i see the warning: "possible loss of data due to type conversion AIC.mq4 281 62"


Probably it does not accept other indicator on "ENUM_APPLIED_PRICE" place of iMA command.

How can I do it??

Thanks!

PS: I see on new MQL4 that I can select all timeframes as on MQL5!! Is this true????? Can I use 2, 3, 4 etc. minutes TF???????????

Alain Verleyen
Moderator
30729
Alain Verleyen 2014.04.03 14:54  
chronisb:

Hello.

Pls if somebody can help me:

On MQL5 we use handles and we can calculate an MA of another MA:

On MQL4 i try this:

and i see the warning: "possible loss of data due to type conversion AIC.mq4 281 62"


Probably it does not accept other indicator on "ENUM_APPLIED_PRICE" place of iMA command.

How can I do it??

Thanks!

PS: I see on new MQL4 that I can select all timeframes as on MQL5!! Is this true????? Can I use 2, 3, 4 etc. minutes TF???????????

Check documentation of iMA() please.
Chronis Boulanikis
2550
Chronis Boulanikis 2014.04.03 15:04  
angevoyageur:
Check documentation of iMA() please.



Thanks for your answer.

Of course I had read both 4 and 5 Docs

MQL4:

applied_price

[in] Applied price. It can be any of ENUM_APPLIED_PRICE enumeration values.

MQL5:

applied_price

[in] The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.

This is the reason that I ask IF I can take a MA of another MA in MQL4!!! Pls, Can you help me if I can do it???

Thanks.


Ian Venner
2584
Ian Venner 2014.04.03 15:08  
chronisb:


This is the reason that I ask IF I can take a MA of another MA in MQL4!!! Pls, Can you help me if I can do it???

Thanks.

You can use iMAOnArray()
Chronis Boulanikis
2550
Chronis Boulanikis 2014.04.03 15:11  
SDC:
You can use iMAOnArray()


Thank you very much!! I'll look for it!
To add comments, please log in or register