Cannot read data from CCFp indicator using iCustom

 

I am trying to read the values of different Buffer from the CCFp indicator but it stay constant at 2147483647  (Empty_value


Here is the code I use to test it :

  Print(handle);
  if (NewBar()){
   double USD = CCFp(0, 1);
   Comment(USD);
}
//+------------------------------------------------------------------+
bool NewBar()
{
   static datetime lastbar;
   
   datetime curbar = Time[0];
   
   if(lastbar!=curbar){
      lastbar=curbar;
      return (true);
   }
   else{
      return (false);
   }
}

double CCFp (int index, int shift){
   bool ShowOnlyPairOnChart = false;
   int MA_Method = 3;
   int Price = 6;
   int Fast = 3;
   int Slow = 5;
   bool USD = 1;
   bool EUR = 1;
   bool GBP = 1;
   bool CHF = 1;
   bool JPY = 1;
   bool AUD = 1;
   bool CAD = 1;
   bool NZD = 1;
   color Color_USD = Green;
   color Color_EUR = DarkBlue;
   color Color_GBP = Red;
   color Color_CHF = Chocolate;
   color Color_JPY = Maroon;
   color Color_AUD = DarkOrange;
   color Color_CAD = Purple;
   color Color_NZD = Teal;
   int Line_Thickness = 2;
   int All_Bars = 100;
   int Last_Bars = 100;
   
   double value =  iCustom(Symbol(),Period(),"CCFp",ShowOnlyPairOnChart,MA_Method,Price,Fast,Slow,USD,EUR,GBP,CHF,JPY,AUD,CAD,NZD,Color_USD,Color_EUR,
                           Color_GBP,Color_CHF,Color_JPY,Color_AUD,Color_CAD,Color_NZD,Line_Thickness,All_Bars,Last_Bars,index,shift);
   return value;
}


 

Try the attached file. There is no particular problem.

Since it operates normally, it seems that you are making a mistake something else, but I do not know it.

If all default setting values ​​are used, all can be omitted like line 113.

Files:
Sample_4.mq4  8 kb
 
Naguisa Unada:

Try the attached file. There is no particular problem.

Since it operates normally, it seems that you are making a mistake something else, but I do not know it.

If all default setting values are used, all can be omitted like line 113.

Thanks so much for the sample code. Unfortunately it doesn't work either, because your code is written as indicator. I implemented my code in EA and run it in strategy tester. It didn't output correct value in strategy tester. Do you know how to fix it ? 
 

I created this indicator to see if the program that you wrote works properly. And it works fine on my MT4.
If it works also on your MT4 without problems, it seems that you are making any another mistake. The difference between EA and indicator is not a problem.
But I can not tell you what you are wrong by only looking at your program, because I don't know what you are doing with it.


 
Naguisa Unada:

I created this indicator to see if the program that you wrote works properly. And it works fine on my MT4.
If it works also on your MT4 without problems, it seems that you are making any another mistake. The difference between EA and indicator is not a problem.
But I can not tell you what you are wrong by only looking at your program, because I don't know what you are doing with it.


I know, it work fine for me to. But seem like the CCFp indicator won't work in strategy tester because it need information of other pairs

 
noname2 :

I know, it work fine for me to. But seem like the CCFp indicator won't work in strategy tester because it need information of other pairs

Finally I could understand your intention.

I made the following EA and tried it. It works well without problems.

If it does not work on your MT4, that's means you're wrong.

Files:
Sample_5.mq4  5 kb
 
Naguisa Unada:

Finally I could understand your intention.

I made the following EA and tried it. It works well without problems.

If it does not work on your MT4, that's means you're wrong.

Thanks so much for your effort ! First , I tried it on MT4 FXDD , didn't work. Then I tried on MT4 FXCM, worked ! . I have no idea why, but anyway it worked. Thanks !