Storing Prices in an array

 

hello everyone.

                       I am looking to save previous 10 prices changes in an array, and use these prices to see if the current price is above or lower then last price. I want to do this becuase i want to manage open orders.

       I know i have to create an array. but i dont know the right method that how should i write it, and what information i need to store. if Anyone could help ?

 
assfianazhar: i dont know the right method that how should i write it, and what information i need to store.
  1. There are multiple depending on what you need. Circular queue would be one.
  2. There are no mind readers here and our crystal balls are cracked. Only you can know what you need.
 
William Roeder:
  1. There are multiple depending on what you need. Circular queue would be one.
  2. There are no mind readers here and our crystal balls are cracked. Only you can know what you need.

i am Sorry. and thankyou for replying in this thread.

What i am trying to ask is that how can i store the previous tick prices in an array.

I have done this so far, but this code is storing the same price in all indexes. how can i make it store each new value in 0 index and move previous value to the 1 or next index.



 MqlTick TickData ;
      

  double tickarray[11];
  static int cnt=10;
    double temp = TickData.ask;
  
  
   for (int i=10; i>1; i--)
    {
    if ( SymbolInfoTick(Symbol(),TickData))
     {
     double temp = TickData.ask;
     Alert (temp);
     Sleep(500);
    }
 
assfianazhar: I have done this so far, but this code is storing the same price in all indexes. how can i make it store each new value in 0 index and move previous value to the 1 or next index.
  1. Of course, it does. Store one value and return until you get a new tick.
  2. Show your code that moves values higher and stores into [0].
 
You have to make a loop moving the values from one array to another one at a time shifting each position up one then storing your newest value in slot 0
Reason: