Download MetaTrader 5

need little help on indirect use of variables

To add comments, please log in or register
Ma Yuliang
288
Ma Yuliang  
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);
   SetIndexBuffer(2,buffer3);
   SetIndexBuffer(3,buffer4);
   SetIndexBuffer(4,buffer5);
   SetIndexBuffer(5,buffer6);
   SetIndexBuffer(6,buffer7);
   SetIndexBuffer(7,buffer8);
   SetIndexBuffer(8,buffer9);

can i write code above in a loop like this

for(i=0;i<9;i++)
{
   SetIndexBuffer(i,"buffer" & i);
}

the code above is not work. I can't find any help in the help files. If anyone know how to use indirect variable name please tell me.

Osama Shaban
1544
Osama Shaban  

I'm not sure, BUT ...

I think, you can't, because the SetIndexBuffer() 

must define outside of the start() function ... while for(..., ..., ...) can only work inside start() or any defined function.

Try it and see what will happen !. 

To add comments, please log in or register