Download MetaTrader 5
To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
pacman992
30
pacman992 2016.01.14 16:21 

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);
}
whroeder1
13602
whroeder1 2016.01.14 16:42  
  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.

pacman992
30
pacman992 2016.01.14 16:59  
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);
/
To add comments, please log in or register