What's wrong with my simple code?

 

I think my code is very simple,but I can't get the result I want,so can somebody please tell me what's wrong?

My code:

#property copyright "lb"

#property link ""

#property indicator_chart_window

double test_value[];

int init()
{
test_value[0] = Low[0];
return(0);
}

int start()
{
Comment(test_value[0]);
return(0);
}
 

How many elements are there in your array ?

https://book.mql4.com/variables/arrays

 
qq19342174:

I think my code is very simple,but I can't get the result I want,so can somebody please tell me what's wrong?

My code:

#property copyright "lb"

#property link ""

#property indicator_chart_window

double test_value[];

int init()
{
test_value[0] = Low[0];
return(0);
}

int start()
{
Comment(test_value[0]);
return(0);
}

you must size and initialize numeric(incl datetime) arrays either at the declaration level or using array operations (arrayinitialize(..., etc) within any functions, but this command can't be used if your array is string or boolean.

 
  1. How many elements are there in your array ?

 
diostar:

you must size and initialize numeric(incl datetime) arrays either at the declaration level or using array operations (arrayinitialize(..., etc) within any functions, but this command can't be used if your array is string or boolean.


Thank you very much,I do as you wrote and my problem solved.Thanks for your kind reply.
 
WHRoeder:
  1. How many elements are there in your array ?


I'm new to this forum,thanks for remind,I already changed.
Reason: