OrderSelect() function

 
Hi,
When I am calling the OrderSelect() function am I calling a server or are the "Order****()" info which is stored in the terminal memory pool every time the terminal window is updated?

I am concerned about a speed while I am using the OrderSelect() and rest of the Order****() functions.

In other words, if I have repeated test of the OrderType() is it faster to first set local variable ot=OrderType(); and than test the "ot" or testing OrderType() each time will bring a similar time result.
 
That's local.
On a demo, not strategy tester, try each order you are concerned with and time how long it takes to execute.
Assume > 100ms = went to server.
int starttime = GetTickCount();
send order
Print("Elapsed time for OrderX was ", GetTickCount() - starttime, " milliseconds")
.
 
That's local.
On a demo, not strategy tester, try each order you are concerned with and time how long it takes to execute.
Assume > 100ms = went to server.
int starttime = GetTickCount();
send order
Print("Elapsed time for OrderX was ", GetTickCount() - starttime, " milliseconds")

OK Phy, so if I do understand you correctly an order parameter of an existent order which is included in the OrderTotal() count is a local variable. So may I assume that a time to fetch such variable would be virtually same as a time to fetch any variable?

Thanks.
 
It is a function call, not a variable.
My opinion you will be wasting your time trying to maintain your own copy of the "database".
Others may have a different opinion.
After selecting an order I just use the OrderXxxxxx() calls for whatever I need to know whenever I need to know it.

Here is a test script... A million calls to four functions, then a million calls to 4 variables. Function is slower as expected. But you can do it at the rate of about 8 million a second, so ???

int start()
  {
	//OrderSend(Symbol(), OP_BUY, 1, Ask, 0, Ask-20*Point, Ask+20*Point, "Hello", 5, 0, Red);
	
	int startTime;
	int i, j;
	double open, sl, tp, profit;
	
	for(i = OrdersTotal()-1; i >= 0; i--){
		OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
		if(OrderComment() == "Hello"){
			
			startTime = GetTickCount();
			for(j = 0; j < 1000000; j++){
				open = OrderOpenPrice();
				sl = OrderStopLoss();
				tp = OrderTakeProfit();
				profit = OrderProfit();
			}
			Print(GetTickCount() - startTime, " milliseconds");
		}
	}

	// variable fetch/assign
	double a, b, c, d;
	startTime = GetTickCount();
	for(j = 0; j < 1000000; j++){
		a = open;
		b = sl;
		c = tp;
		d = profit;
	}
	Print(GetTickCount() - startTime, " milliseconds");
	
							
   return(0);
  }
  
/*  
Output:
 
2008.08.13 02:47:29	zzzzz EURUSD,M5: removed
2008.08.13 02:47:29	zzzzz EURUSD,M5: uninit reason 0
2008.08.13 02:47:29	zzzzz EURUSD,M5: 47 milliseconds
2008.08.13 02:47:29	zzzzz EURUSD,M5: 437 milliseconds
2008.08.13 02:47:29	zzzzz EURUSD,M5: loaded successfully
2008.08.13 02:47:25	zzzzz EURUSD,M5: removed
2008.08.13 02:47:25	zzzzz EURUSD,M5: uninit reason 0
2008.08.13 02:47:25	zzzzz EURUSD,M5: 78 milliseconds
2008.08.13 02:47:25	zzzzz EURUSD,M5: 172 milliseconds
2008.08.13 02:47:25	zzzzz EURUSD,M5: loaded successfully
2008.08.13 02:47:12	zzzzz EURUSD,M5: removed
2008.08.13 02:47:12	zzzzz EURUSD,M5: uninit reason 0
2008.08.13 02:47:12	zzzzz EURUSD,M5: 94 milliseconds
2008.08.13 02:47:12	zzzzz EURUSD,M5: 453 milliseconds
2008.08.13 02:47:11	zzzzz EURUSD,M5: loaded successfully

*/


Reason: