Thread: Ask!
View Single Post
  #988 (permalink)  
Old 02-24-2008, 03:32 PM
SimonF SimonF is offline
Junior Member
 
Join Date: Jan 2008
Posts: 24
SimonF is on a distinguished road
How to keep track of multiple orders?

I'm currently making an EA that only has 1 open trade at a time.
I have alot of variables to keep track of what is happening during this trade.
If I had more open trades at the same time I thought I could use arrays for these variables with the ticket number as key. But as I understand it the keys has to be 0,1,2,3 etc right? So this wouldn't be possible.

Instead of that I could have a multidimension array like this, I hope you understand my javascript/php like description.
barsSinceOpen = array(
0 => array(0 => 123123, 1 => 63)
1 => array(0 => 552352, 1 => 5)
);
0 in second dimension would be ticket number, and 1 would be amount of bars since the trade was open.
barSinceOpen is just an example.. I know I could calculate this one out for each trade every time I want, but that's not the point. I have ALOT of things I keep track of for a trade.

And to select the correct order I would have to iterate over the array and select the 2nd level array with correct ticket.

Do you think this is a good idea? How would you do it?
__________________
boo
Reply With Quote