assign values to array using for i loop

 

Hi,

apollogies for this question, but I can't seem to get it done right on MT4. 

I have an array status[20] defined below input parameters using the following.

string status[20];

Now I'm trying to assing the word "pending" to each of them using a for i loop in  

int init ()

{

for(int i=0; i<20; i++)

     {

        status[i]=(pending);

        } 

return(0);

  } 

This doesn't work. I use ObjectCreate, ObjectSetText, ObjectSet to display these and other values on the chart, but the array hasn't loaded the values. I tried with numbers instead but got the same result.

When I assign values to my string using this: 

string status[20];="1pending1","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","pending","lastof20"}; 

The values are correctly assigned to my array and display correctly on the chart.

Thanks for your help in advance 

 
string status[20];
for(int i=0; i<20; i++)
  {
   status[i]="pending";
  } 
 
honest_knave:

sorry about the typo, of course in my code it is status[i]="pending"; and not status[i]=(pending);

 

this is my

int Init()

  {

//---


      //GetTickSize (); I"m doing it manually, where one pip on my broker is 0.0001

      //establish initial position using moving average

      GetBuySellPosition ();

      //define all the values/strings

      

      for(int i=0; i<20; i++)

     {

        status[i]="pending";

        }

      

   //---

   return(0);

  } 

i just double checked, but it doesn't work. there must be something else wrong in there. 

Can values be assigned to arrays in the int init (); ? 

 

1) Please use SRC-button if you post code!

2) Walk through the problematic part by using the Debugger! Place DebugBreak(); before the lines you need or press F9.