iCustom() works or not? or what?

 
Hi All!

I wrote an indicator for a 1 minute chart. It shows drawing arrows. The value of the arrows are -3 or 16 depend on my defined condition ( EMA(CCI(13),5) rise AND > 0 ) is false or true.

The indicator works fine.

I would like to receive datas (of LOA9 variable) from the above indicator for my EA. I use the iCustom() fuction, but something doesnt work properly.

Here is the code of the indicator:

#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1 Pink
#property indicator_minimum 10
#property indicator_maximum +20
 
double   CCI[];         
double   LOA9[];     //Variable of my condition. False: -3, True: 16
double   TIME[];     //Checking time number
 
int ExtCountedBars=0 ;
 
int init()
  {
   IndicatorShortName(" -== AXORYN ==- " );
   IndicatorDigits(Digits-4) ;
 
   SetIndexBuffer(0,LOA9); SetIndexStyle(0,3);  SetIndexLabel(0,"LOA9");
   SetIndexBuffer(1,CCI);  SetIndexStyle(1,12); SetIndexLabel(1,"CCI");
   SetIndexBuffer(2,TIME); SetIndexStyle(2,12); SetIndexLabel(2,"TIME");
   
   return(0);
  }
 
//+------------------------------------------------------------------+
 
int start()
  {
   if(Bars<=10) return(0);
   ExtCountedBars=IndicatorCounted();
   if (ExtCountedBars<0) return(-1);
   if (ExtCountedBars>0) ExtCountedBars--;
 
   int i = Bars-ExtCountedBars-1;
   while( i>=0 )
     {
      int i15 = iBarShift(NULL,15,iTime(NULL,1,i)) ;
      CCI[i15]= iCCI(NULL,15,13,PRICE_TYPICAL,i15) ;  //Prepare CCI array for iMAOnArray()
         i--;
     }
 
   int k = Bars-ExtCountedBars-1;
   while( k>=0 )
     {
      int k15 = iBarShift(NULL,15,iTime(NULL,1,k)) ;
 
         TIME[k] = iTime(NULL,0,k) ;                  //Grab the time number for checking
 
      //Condition = EMA(CCI(13),5) rise AND > 0
 
      if ( iMAOnArray(CCI,0,5,0,MODE_EMA,k15+2) > iMAOnArray(CCI,0,5,0,MODE_EMA,k15+1)
         &&  iMAOnArray(CCI,0,5,0,MODE_EMA,k15+2) > 0 )
         LOA9[k] = 16;                                //The condition is true => 16
      else
         LOA9[k] = -3 ;                               //The condition is false => -3
        k--;
     }
   return(0);
 }

Here is the code of the Expert Advisor:

int init()
  {
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()       // EA will receive datas from the _LOA4 indicator and write them to the Journal by the Back Testing
                  // Time interval: 02.01.2007. 11:11-11:20 - Ten minutes
  {
   if ( Hour() == 11 && Minute() > 10 && Minute() < 21 )       //Check only minutes 11 to 20
   Alert("Minute is " + Minute() + 
   " LOA9=" + DoubleToStr(iCustom(NULL,0,"_LOA4",0,1),0) +     //receive value of LOA9 of the previous minute from indicator "_LOA4"
   " Time=" + DoubleToStr(iCustom(NULL,0,"_LOA4",2,1),0) ) ;   //receive value of TIME check number of the previous minute from the indicator
   return(0);
  }

When i run it on the Back Tester, it doesnt give me the good values. But only just the values of the LOA9 variables are diffrent. The TIME check number works fine.

The EA back tester Journal Result (Every tick Model):

2007.02.16 16:11:46 2007.01.02 11:19 AXORYN_3 EURUSD,M1: Alert: Minute is 19 LOA9=-3 Time=1167736680
2007.02.16 16:11:46 2007.01.02 11:19 AXORYN_3 EURUSD,M1: Alert: Minute is 19 LOA9=-3 Time=1167736680
2007.02.16 16:11:46 2007.01.02 11:19 AXORYN_3 EURUSD,M1: Alert: Minute is 19 LOA9=-3 Time=1167736680
2007.02.16 16:11:46 2007.01.02 11:18 AXORYN_3 EURUSD,M1: Alert: Minute is 18 LOA9=-3 Time=1167736620
2007.02.16 16:11:46 2007.01.02 11:18 AXORYN_3 EURUSD,M1: Alert: Minute is 18 LOA9=-3 Time=1167736620
2007.02.16 16:11:46 2007.01.02 11:18 AXORYN_3 EURUSD,M1: Alert: Minute is 18 LOA9=-3 Time=1167736620
2007.02.16 16:11:46 2007.01.02 11:18 AXORYN_3 EURUSD,M1: Alert: Minute is 18 LOA9=-3 Time=1167736620
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:17 AXORYN_3 EURUSD,M1: Alert: Minute is 17 LOA9=-3 Time=1167736560
2007.02.16 16:11:46 2007.01.02 11:16 AXORYN_3 EURUSD,M1: Alert: Minute is 16 LOA9=-3 Time=1167736500
2007.02.16 16:11:46 2007.01.02 11:16 AXORYN_3 EURUSD,M1: Alert: Minute is 16 LOA9=-3 Time=1167736500
2007.02.16 16:11:46 2007.01.02 11:16 AXORYN_3 EURUSD,M1: Alert: Minute is 16 LOA9=-3 Time=1167736500
2007.02.16 16:11:46 2007.01.02 11:15 AXORYN_3 EURUSD,M1: Alert: Minute is 15 LOA9=-3 Time=1167736440
2007.02.16 16:11:46 2007.01.02 11:15 AXORYN_3 EURUSD,M1: Alert: Minute is 15 LOA9=-3 Time=1167736440
2007.02.16 16:11:46 2007.01.02 11:15 AXORYN_3 EURUSD,M1: Alert: Minute is 15 LOA9=-3 Time=1167736440
2007.02.16 16:11:46 2007.01.02 11:15 AXORYN_3 EURUSD,M1: Alert: Minute is 15 LOA9=-3 Time=1167736440
2007.02.16 16:11:46 2007.01.02 11:15 AXORYN_3 EURUSD,M1: Alert: Minute is 15 LOA9=-3 Time=1167736440
2007.02.16 16:11:46 2007.01.02 11:14 AXORYN_3 EURUSD,M1: Alert: Minute is 14 LOA9=-3 Time=1167736380
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:13 AXORYN_3 EURUSD,M1: Alert: Minute is 13 LOA9=-3 Time=1167736320
2007.02.16 16:11:46 2007.01.02 11:12 AXORYN_3 EURUSD,M1: Alert: Minute is 12 LOA9=-3 Time=1167736260
2007.02.16 16:11:46 2007.01.02 11:12 AXORYN_3 EURUSD,M1: Alert: Minute is 12 LOA9=-3 Time=1167736260
2007.02.16 16:11:46 2007.01.02 11:12 AXORYN_3 EURUSD,M1: Alert: Minute is 12 LOA9=-3 Time=1167736260
2007.02.16 16:11:46 2007.01.02 11:11 AXORYN_3 EURUSD,M1: Alert: Minute is 11 LOA9=16 Time=1167736200
2007.02.16 16:11:46 2007.01.02 11:11 _LOA4 EURUSD,M1: loaded successfully
2007.02.16 16:11:46 AXORYN_3 started for testing
2007.02.16 16:11:46 _LOA4 EURUSD,M1: removed

But the original LOA9 values of the _LOA4 indicator are:

Minute 10 - LOA9= 16
Minute 11 - LOA9= 16
Minute 12 - LOA9= 16
Minute 13 - LOA9= 16
Minute 14 - LOA9= 16
Minute 15 - LOA9= -3
Minute 16 - LOA9= -3
Minute 17 - LOA9= -3
Minute 18 - LOA9= -3
Minute 19 - LOA9= -3

I tried other testing models too, but caused the same result.

I don't know why is the diffrent working between the two values (LOA9 & TIME check number) of indicator.

If you have any idea, plese help me.

Thank You.

Relative
Reason: