Using Arrays to track info for All Open Orders

 

Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!

dee

 

very good and generic idea!

deeforex:
Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!

dee

dee,

It's a very good and generic idea! this array could be used for a lot of purposes!

I'll give it a hand!

 
codersguru:
I'll give it a hand!

 

I'm desperate here. I've been trying all night to get my array to work but nothing happens. I've realy tried to be self-sufficient and to try to learn but I still can't get to where I need to go. If someone could please have mercy upon me and lend me some assistance....PLEASE!!!!!

I'm running a grid script but would like to track how many lots I'm running by Symbol. I want to be able to add up what my total position is by lotsize. Let's say I have 0.10, 0.10, 0.10, 0.10, 0.20, 0.30, I want to be able know that I have the equivalent to 0.90 lots. I would also like to know the minimum and maximum lot sizes....0.10 and 0.30

ArrayResize(OrderArray, i);

ArrayInitialize(OrderArray,0);

cnt = 0;

for (i = 0; i < OrdersTotal(); i++)

{

if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() )

{

OrderArray[cnt][PROFIT] = OrderProfit() + OrderSwap();

OrderArray[cnt][OPEN] = OrderOpenPrice();

OrderArray[cnt][LOTS] = OrderLots();

if(OrderType() == OP_BUY)

{

////// I can't get anything to work!!!!!!!

BuyLots += OrderArray[cnt][LOTS];

////// This returns Zero when I place BuyLots in my Comments

////// This returns error messages

MaxBuyLots =ArrayMaximum(OrderArray[LOTS],WHOLE_ARRAY,0);

}

 

you always count the 0th index

anyway that the great idea .. i agree, coderguru

looking forward to see your great code soon

 

More about Arrays

deeforex,

I'm writing an article right now about this issue !

Please track it at:

http://www.metatrader.info/node/161

 
codersguru:
deeforex,

I'm writing an article right now about this issue !

Please track it at:

http://www.metatrader.info/node/161

....Today we are going to study an example of 2 dimensional array and a very useful code that "Using Arrays to track info for All Open Orders" (Do you hear me deeforex ?)

I'm listening loud and clear Thanks Codersguru!

Reason: