How to memorize ticks in a array?

 

Hi!

I'd like to create a array like that

double Array_BidTick[]; 

Array_TickBid[0] = Current bid tick

Array_TickBid[1] = Previous bid tick 

Array_TickBid[2] = Previous previous bid tick 

So, I don't know how do it...

I'd like to help...

Thanks!!! 

 
JHenry:

Hi!

I'd like to create a array like that

double Array_BidTick[]; 

Array_TickBid[0] = Current bid tick

Array_TickBid[1] = Previous bid tick 

Array_TickBid[2] = Previous previous bid tick 

So, I don't know how do it...

I'd like to help...

Thanks!!! 

Like this :

   #define _bidTickSize 100
   double Array_BidTick[_bidTickSize];
      for (int k=_bidTickSize-1; k>0; k--) Array_BidTick[k] = Array_BidTick[k-1];
                                           Array_BidTick[0] = Bid;
Just replace the _bidTickSize value with your desired value
 

I created this: 

//+------------------------------------------------------------------+
//| Global Scope                                                     |
//+------------------------------------------------------------------+


double Ask[2];
double Bid[2];

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  
   SymbolInfoTick(Symbol(), Tick);
  
   Ask[0] = Ask[1];
   Ask[1] = Tick.ask;
  
   Bid[0] = Bid[1];
   Bid[1] = Tick.bid;
  
//---
  }
//+------------------------------------------------------------------+
//| End                                                              |
//+------------------------------------------------------------------+

 I think that working correctly... ;)

 
JHenry:

I created this: 

//+------------------------------------------------------------------+
//| Global Scope                                                     |
//+------------------------------------------------------------------+


double Ask[2];
double Bid[2];

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  
   SymbolInfoTick(Symbol(), Tick);
  
   Ask[0] = Ask[1];
   Ask[1] = Tick.ask;
  
   Bid[0] = Bid[1];
   Bid[1] = Tick.bid;
  
//---
  }
//+------------------------------------------------------------------+
//| End                                                              |
//+------------------------------------------------------------------+

 I think that working correctly... ;)

That is the same thing but with an array with only two elements
Reason: