Download MetaTrader 5

getting compleet dataset from multiple timeframes in oncalculate()

To add comments, please log in or register
Bert
61
Bert  

Hi,

In the onCalculate() I have the compleet data set from the current chart with:

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])

 and

   ArraySetAsSeries(ExtLowHighBuffer,false);
   ArraySetAsSeries(ExtHighLowBuffer,false);
   ArraySetAsSeries(ExtOpenBuffer,false);
   ArraySetAsSeries(ExtCloseBuffer,false);
   ArraySetAsSeries(BuyBuffer,false);
   ArraySetAsSeries(SellBuffer,false);
   ArraySetAsSeries(open,false);
   ArraySetAsSeries(high,false);
   ArraySetAsSeries(low,false);


That is working perfectly....

Say I'm in the Daily-chart then this is the data for the Daily. In this case I also want to work with the complete dataset from the eg. H1 or M5-charts. How can I get this data in ones into my Indicator?

Thanks.

whroeder1
16105
whroeder1  
bertje: I also want to work with the complete dataset from the eg. H1 or M5-charts. How can I get this data in ones into my Indicator?

  1. Timeseries and Indicators Access - MQL4 Reference
  2. ArrayCopyRates - Array Functions - MQL4 Reference
Note that these are all time series. Don't set your buffers to false. Don't use the variables, use the Predefined Variables - MQL4 Reference
Bert
61
Bert  

Thanks,

You said, don't set your buffers to false. Why? I set them to false because I needed this to invert the order of the rates...

In the manual I only can destilate that it just change the indexing.

Alain Verleyen
Moderator
33502
Alain Verleyen  
bertje:

Thanks,

You said, don't set your buffers to false. Why? I set them to false because I needed this to invert the order of the rates...

In the manual I only can destilate that it just change the indexing.



You can set your buffers "to false". You have to pay attention to your indexing, don't mix "as series" and "not as series".

Usually it's simpler to use buffers as series ("to true"), but it depends of your needs.

Bert
61
Bert  

Thanks....

Am I right that I can't use the Arrayfunctions as ArrayBSearch, ArrayMaximum, if I use buffers NOT as series ("to false")?

Alain Verleyen
Moderator
33502
Alain Verleyen  
bertje:

Thanks....

Am I right that I can't use the Arrayfunctions as ArrayBSearch, ArrayMaximum, if I use buffers NOT as series ("to false")?


Of course.
Bert
61
Bert  
Thanks!
To add comments, please log in or register