Order Select, stupid little nifty question

 

Hi all,

given 5 closed orders in HISTRORY.

means OrdersHistoryTotal(); returns 5.

Now Order select by index and SELECT_BY_POS,MODE_HISTORY

MODE_HISTORY seems to depend on Terminal TAB settings of History, e.g. time period, but also others??

Question: How does index in Order_Select now adress these orders? What does index=0 point to, or what does index=5 point to??

Is there any dependency on sorting in the Terminal TAB ??

Thanks in advance

hk

 

may I add the following question:

The Terminal HISTORY tab shows executed SL by filling the SL col red.

Is there any Flag or something, by which I can determine if the position was closed by SL execution?


Rgds

hk

 
lve0200:

may I add the following question:

The Terminal HISTORY tab shows executed SL by filling the SL col red.

Is there any Flag or something, by which I can determine if the position was closed by SL execution?


Rgds

hk

No you need to check the prices.
 
lve0200:

Hi all,

given 5 closed orders in HISTRORY.

means OrdersHistoryTotal(); returns 5.

Now Order select by index and SELECT_BY_POS,MODE_HISTORY

MODE_HISTORY seems to depend on Terminal TAB settings of History, e.g. time period, but also others??

Question: How does index in Order_Select now adress these orders? What does index=0 point to, or what does index=5 point to??

Is there any dependency on sorting in the Terminal TAB ??

Thanks in advance

hk

I think the following function I did will answer your question ...

It's function is to pick the last closed trade type, lots and profit. So, as long as it is last trade, then you can now know which index number to which trade.

The function works perfect. 

void LastClosedTrade(){ 
   int cnt, total; 
   total = OrdersHistoryTotal(); 
   for(cnt=0;cnt<total; cnt++){ 
      if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)==true)
   
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNo){
         LastOrderType = OrderType(); 
         LastOrderLots = OrderLots(); 
         LastOrderProfit = OrderProfit(); 
      }
   }
}
 
No. 
lve0200:

Hi all,

...

Is there any dependency on sorting in the Terminal TAB ??

...


NO 

Reason: