Indicators From Indicators

 

The Documentation states that 

When requesting data from the indicator, if requested timeseries are not yet built or they need to be downloaded from the server, the function will immediately return -1, but the process of downloading/building will be initiated.

So my question is this . 

If from an indicator you request the ma of another timeframe (which always returns -1 on the first call) ,does that mean that the requested data will be allocated into the referenced array or will these values remain -1 and a subsequent call must be done to get the values ? [or else how to know the values requested are ready]

 
Lorentzos Roussos:

The Documentation states that 

So my question is this . 

If from an indicator you request the ma of another timeframe (which always returns -1 on the first call) ,does that mean that the requested data will be allocated into the referenced array or will these values remain -1 and a subsequent call must be done to get the values ? [or else how to know the values requested are ready]

Use BarsCalculated - 

Return Value

Returns the amount of calculated data in the indicator buffer or -1 in the case of error (data not calculated yet)

Documentation on MQL5: Timeseries and Indicators Access / BarsCalculated
Documentation on MQL5: Timeseries and Indicators Access / BarsCalculated
  • www.mql5.com
BarsCalculated - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov:

Use BarsCalculated - 

Thanks ,i made 2 indicators to study the sequence of data . it helps 

It prints data in the experts tab , im attaching them if someone wants to test themselves.

Call the Master Indicator which in turn calls 3 instances of the Slave Indicator :

  • one in the same symbol and chart tf
  • one in the same symbol and a higher tf
  • and one in a random symbol on a higher tf

Thank you