Download MetaTrader 5

Assigning Bid and Ask to an array

To add comments, please log in or register
Boyan_K
24
Boyan_K  

Hi guys,

 

I'm having trouble assigning Bid or Ask price into an array. When I try to assign it to my array nothing happens, when debugging it just simply stops without any Err. ??

float  _Ask[];
float  _Bid[];

      for(i=0; i>=0;i--)

      {  _Ask[i]=Ask;
         _Bid[i]=Bid;   
      }
 
Keith Watford
Moderator
10362
Keith Watford  

You don't size the arrays

Your for loop is rather strange as it will only ever run 1 pass, when i==0 

Boyan_K
24
Boyan_K  
GumRai:

You don't size the arrays

Your for loop is rather strange as it will only ever run 1 pass, when i==0 

  I'm just using this loop while trying to assign Bid and Ask into my array, so it is not part of any program. I'll try to size the array and see how it goes. 

  ty 

Keith Watford
Moderator
10362
Keith Watford  
  int size=10;
  double  _Open[];
  ArrayResize(_Open,size);
  double  _Close[];
  ArrayResize(_Close,size);

      for(int i=0; i<size;i++)
      {  _Open[i]=Open[i];
         _Close[i]=Close[i];   
      }
just as an example
To add comments, please log in or register