ordersend attached at an array

 

hola

i hope that all member of the forum are ok.

my question is that can i attached at any moment openprice of all orders to an array and if it s possible what is the code to realize it.

ex:

price[10]={1.3560, 1.3600, ........}

 
izmnaari:
my question is that can i attached at any moment openprice of all orders to an array and if it s possible what is the code to realize it.
You probably do not want ALL orders, only that EA's - so filter by magic number and pair.
int count=0;    double openPrices[];
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
    OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
&&  OrderMagicNumber()  == magic.number             // my magic number
&&  OrderSymbol()       == Symbol() ){              // and my pair.
    ResizeBuffer(openPrices, count+1);
    openPrices[count] = OrderOpenPrice();
    count++;
}
 
WHRoeder:
You probably do not want ALL orders, only that EA's - so filter by magic number and pair.


thank you very much that s what i need

thank you

but i have change an expression in your code

int count=0;    double openPrices[];
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
    OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
&&  OrderMagicNumber()  == magic.number             // my magic number
&&  OrderSymbol()       == Symbol() ){              // and my pair.
    ArrayResize(openPrices, count+1);
    openPrices[count] = OrderOpenPrice();
    count++; 

}

 
izmnaari:
but i have change an expression in your code
Of course. ResizeBuffer is a function in my code, that expands and shifts values so array[0] is the new one.