I am confused

To add comments, please log in or register
Larry
1340
Larry  

I am not sure if I am doing this right.  In MT4, we collect indictor values and put them into buffer arrays, from what I have picked up in the indicator code for MT5, I see the same thing, for the most part, BUT, I just got done checking out this EA that utilizes iBands.  In this code, the author creates array buffers and handles in the EA to collect the data of the iBands. 

 

Do I need to use this method of collecting the values?  Could I get away with something like just assigning the specific indicator number value to a variable?

 

It also seems that I must collect the price into buffer arrays is this also correct?  In the case of the above EA, he is using mrate.

 

Ok these may be stupid questions, but I am going through transition shock, I promise to take my meds. 

Alexey Da
6602
Alexey Da  

Please explain your question with examples.

What do you want to do: new indicator or EA based on indicator?

gen.on.ea
54
gen.on.ea  
//--- get handle of the Bollinger Bands and DEMA indicators
   BolBandsHandle=iBands(NULL,PERIOD_M30,bands_period,bands_shift,deviation,PRICE_CLOSE);
   demaHandle=iDEMA(NULL,PERIOD_D1,dema_period,0,PRICE_CLOSE);
/*
     Let's make sure our arrays values for the Rates and Indicators
     is stored serially similar to the timeseries array
*/

// the rates arrays
   ArraySetAsSeries(mrate,true);
   ArraySetAsSeries(demaVal,true);
// the indicator arrays
   ArraySetAsSeries(BBUp,true);
   ArraySetAsSeries(BBLow,true);
   ArraySetAsSeries(BBMidle,true);

https://www.mql5.com/en/docs/array/arraysetasseries


ArraySetAsSeries

The function sets the AS_SERIES flag to a selected object of a dynamic array, and elements will be indexed like in timeseries.

Documentation on MQL5: Array Functions / ArraySetAsSeries
  • www.mql5.com
Array Functions / ArraySetAsSeries - Documentation on MQL5
To add comments, please log in or register