Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1287

 

Please advise!

How to calculate EMA from Volume in MQL5. In MQL4 there was an iMAonArray() function, but in MQL5 I understand there is no such a function.

 
Madmas:

Please advise!

How to calculate EMA from Volume in MQL5. In MQL4 it had iMAonArray() function, but in MQL5 I think it's absent.

I have to create a handle foriVolumes indicator. Then create an iMA indicator handle, but use iVolumes handle instead of price:

//--- create handle of the indicator
   handle_iVolumes=iVolumes(Symbol(),Period(),Inp_Volumes_applied_volume);
//--- if the handle is not created
   if(handle_iVolumes==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code
      PrintFormat("Failed to create handle of the iVolumes indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early
      return(INIT_FAILED);
     }
//--- create handle of the indicator iMA
   handle_iMA=iMA(Symbol(),Period(),Inp_MA_ma_period,Inp_MA_ma_shift,
                  Inp_MA_ma_method,handle_iVolumes);
//--- if the handle is not created
   if(handle_iMA==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code
      PrintFormat("Failed to create handle of the iMA indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early
      return(INIT_FAILED);
     }

Result:

MAOnVolumesOnMA

Files:
 
Vladimir Karputov:

We need to create a handle for the iVolumes indicator. Then create an iMA indicator handle, but substitute iVolumes handle instead of price:

Result:


Thank you, I will look into it)))).... learn

 
Madmas:

Thanks, I'll look into it)))).... learn

Just a note: THIS might not give out the correct data...

 
Сергей Таболин:

Just a note: THIS may not give out the correct data...

Why? What's it got to do with it? And if so, what other options are there?

 
Madmas:

Why? What does it have to do with?

I have no idea... Asked this question on the forum - no answer...

 
Сергей Таболин:

I have no idea... Asked this question on the forum - no answer...

What is the problem with the data? Visually it seems to be the same as Volume+MA indicator, I've scrolled through the history

 
Сергей Таболин:

I have no idea... Asked this question on the forum - no answer...

The only difference is long and double data type

 
Madmas:

The only difference is the data type long and double

Take a look at this. It may not be a general glitch, but it's also tense in a particular case...

MT5 :: Где искать ошибку? Или ошибка индикатора, работающего по данным другого индикатора?
MT5 :: Где искать ошибку? Или ошибка индикатора, работающего по данным другого индикатора?
  • 2020.10.13
  • www.mql5.com
Здравствуйте. У меня есть тиковый индикатор, который не привязан ни к какому ТФ. На его основе, я написал советник...
 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
Reason: