Problem with history

 

Hi there,
i am a little confused about the history feature. The following sourcecode is showing me active orders as well. I tried to study the reference but i was not able to solve my problem.
How is it possible to avoid a result of active orders? My objective  is just to see closed orders.

Thanks a lot in advance

   


datetime from=TimeCurrent()-(3600*hours_back_history); 
datetime to=TimeCurrent(); 

HistorySelect(from,to); 
ulong    ticket; 
uint     totalh=HistoryOrdersTotal(); 

for(uint i=0;i<totalh;i++) 
	{ 
       		if((ticket=HistoryOrderGetTicket(i))>0) 
	      	{ 
       		double preis_final = HistoryOrderGetDouble(ticket, ORDER_PRICE_CURRENT);
	        t_string = t_string + (string)HistoryOrderGetTicket(i) + ";"+(string)preis_final+";;";
        	}
        }