Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 can create custom graphical tools?
Boyan_K
24
Boyan_K 2015.03.20 09:10 

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
7906
Keith Watford 2015.03.20 09:15  

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 2015.03.20 09:30  
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
7906
Keith Watford 2015.03.20 10:06  
  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