Need help for iCustom function

 

Hi,

I would like to use iCustom function inside custom indicator but can not get the correct values from MACD indicator. I need the MACD values for H4 time frame but my custom indicator to be attached to M5 chart. The part of the code is below. In the example buffer1 is for Down arrows, buffer2 is for Up arrows. Please help to fix that issue.

<CODE REMOVED>

 
elo15:

Hi,

I would like to use iCustom function inside custom indicator but can not get the correct values from MACD indicator. I need the MACD values for H4 time frame but my custom indicator to be attached to M5 chart. The part of the code is below. In the example buffer1 is for Down arrows, buffer2 is for Up arrows. Please help to fix that issue.

...

Please use SRC button when you post code.

When working with an other symbol/timeframe, you have to use iHigh/iLow :

   for(int i=0;i<limit;i++)
     {
      mMACD=iCustom(NULL,240,"#MTF_MACD",240,12,26,9,0,0,i);

      mMACDSignal=iCustom(NULL,240,"#MTF_MACD",240,12,26,9,0,1,i);

      if(mMACD<mMACDSignal)
        {

         ExtMapBuffer1[i]=iHigh(NULL,PERIOD_H4,i)+30*Point;

        }

      if(mMACD>mMACDSignal)
        {

         ExtMapBuffer2[i]=iLow(NULL,PERIOD_H4,i)-30*Point;

        }
     }
 
elo15:

Hi,

I would like to use iCustom function inside custom indicator but can not get the correct values from MACD indicator. I need the MACD values for H4 time frame but my custom indicator to be attached to M5 chart. The part of the code is below. In the example buffer1 is for Down arrows, buffer2 is for Up arrows. Please help to fix that issue.

<CODE REMOVED>


I removed your code . . . .


Please edit your post above and re-insert your code using the SRC button . . . please use the SRC button to post code: How to use the SRC button.

To edit your post . . .

 
mMACD=iCustom(NULL,240,"#MTF_MACD",240,12,26,9,0,0,i);


  1. Start with i is the index to your M5 chart, yet you pass it to a H4 chart which is bogus. If i is 6 your bar is 30 minutes ago but you ask for the indicator value for the bar 24 hours ago. Try null,0
  2. Don't bother to post the indicator code or a link to it and we won't bother to see if the call is valid.
  3. Detailed explanation of iCustom - MQL4 forum
 

Thank you for your help guys, WHRoeder you advised to use "null,0" which were the right parameters and the code is working fine:

mMACD=iCustom(NULL,0,"#MTF_MACD",240,12,26,9,0,0,i);