My iCustom code always return empty value (2147483647)

 

this is the indicator code


 

double val[];
int count=0;

int init(){
SetIndexBuffer(0,val);
return (0);
}

int start(){
	TheValue=count;
	ArrayResize(val,count+1);
	val[count]=TheValue;
	count++;
return (0);
}

int deinit(){
return (0);
}

Now this is the ea

#property strict

int init(){
return(0);
}

int start(){
	double val = iCustom(NULL,0,"indicator",0,0); //i'm not sure about this line
	alert("value = "+ val);
return(0);
}

int deinit(){
return(0);
}
 
  1. You never declared that your indicator has any buffers Program Properties (#property) - MQL4 Documentation

  2. SetIndexBuffer(0,val);
    
    ArrayResize(val,count+1);
    ArrayResize - MQL4 Documentation
    Note

    The function can be applied only to dynamic arrays. It should be noted that you cannot change the size of dynamic arrays assigned as indicator buffers by the SetIndexBuffer() function. For indicator buffers, all operations of resizing are performed by the runtime subsystem of the terminal.

 
WHRoeder:
  1. You never declared that your indicator has any buffers Program Properties (#property) - MQL4 Documentation

  2. ArrayResize - MQL4 Documentation
    Note

    The function can be applied only to dynamic arrays. It should be noted that you cannot change the size of dynamic arrays assigned as indicator buffers by the SetIndexBuffer() function. For indicator buffers, all operations of resizing are performed by the runtime subsystem of the terminal.

thank you for your answer, i forgot the #property indicator_buffer. One more question, assume there are no problem with the code from indicator, is this iCustom calling code from ea is proper? thank you again sir
double val = iCustom(NULL,0,"indicator",0,0);
Reason: