iCustom(... question

 

Hi


I've had a look at the use of iCustom on EAs and looks like they should work okay, but the numbers i receive back are nothing like i see whe charting the EA for my own CI.  So, I tried this



  // only enter on the 1st tick of the bar

   if (!is5MinBar())

      return(false);

 

    double signal=iCustom(Symbol(), PERIOD_M5, "CCI",14,0,1);

      Print("MACD signal="+signal);


and again the  the printed values from my EA are completely different to the chart values.  Same instrument on 5 Min chart.


Any ideas??


 
Peter167f wrote >>

Hi

I've had a look at the use of iCustom on EAs and looks like they should work okay, but the numbers i receive back are nothing like i see whe charting the EA for my own CI. So, I tried this

// only enter on the 1st tick of the bar

if (!is5MinBar())

return(false);

double signal=iCustom(Symbol(), PERIOD_M5, "CCI",14,0,1);

Print("MACD signal="+signal);

and again the the printed values from my EA are completely different to the chart values. Same instrument on 5 Min chart.

Any ideas??

for CCI, why not just use iCCI(..)

 
Peter167f wrote >>

Hi

I've had a look at the use of iCustom on EAs and looks like they should work okay, but the numbers i receive back are nothing like i see whe charting the EA for my own CI. So, I tried this

// only enter on the 1st tick of the bar

if (!is5MinBar())

return(false);

double signal=iCustom(Symbol(), PERIOD_M5, "CCI",14,0,1);

Print("MACD signal="+signal);

and again the the printed values from my EA are completely different to the chart values. Same instrument on 5 Min chart.

Any ideas??

Hi Peter,

Look at the iCustom function : https://docs.mql4.com/indicators/iCustom, and into the code of your CCI indicator to match the 'mode' parameter with the buffer that contains the data you want to get back in your program. If you do not have the code, try to change to mode=1, or 2... and see if the data you get match your expectation. Some indicators use more than one data (for exemple to draw more than one line) so they need more than one buffer or just need buffer for some other calculation reason. You have to find wich one contains the value you need. Of course you must set the name parameter with the name of the indicator you want to get the data from (here is 'CCI' and in your first sentence you're talking of 'your own CI')

Reason: