Function returning number of Bars for a specified TF - page 2

 
mkheidzedavid:

Man I have created a third indicator

This indicator uses the function Bars inside

which gives wrong result because if Im on a D1 chart I need GMACD to be calculated from H4 TF and now it works on "CURRENT" chart

  1. which you haven't shown
  2. which you don't need
  3. Get the value of the H4 GMAC via your iCustom Call.
    int iH4 = iBarShift(NULL, PERIOD_H4, Time[i]);
    buffer[i] = iCustom(NULL, PERIOD_H4, ..., iH4);

 
mkheidzedavid:
Man I have created a third indicator which requires the values from this indicator and extracts them via 4 of the buffers of GMACD indicator shown above. This indicator uses the function Bars inside which gives wrong result because if Im on a D1 chart I need GMACD to be calculated from H4 TF and now it works on "CURRENT" chart so returns the number of bars via Bars variable for D1 (while I need H4). 

Learn to type less and read more . . .

WHRoeder:
What does the indicator code have to do with your getting the values via iCustom? What is the second argument to iCustom?
Well ?
Reason: