Download MetaTrader 5

Order Select, stupid little nifty question

To add comments, please log in or register
We have launched Spanish and Portuguese versions of the website. Try them!
lve0200
60
lve0200 2016.03.19 11:46 

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

lve0200
60
lve0200 2016.03.19 12:39  

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

Alain Verleyen
Moderator
30737
Alain Verleyen 2016.03.19 12:40  
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.
Osama Shaban
1448
Osama Shaban 2016.03.19 14:27  
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(); 
      }
   }
}
Vasyl Nosal
18546
Vasyl Nosal 2016.03.19 14:50  
No. 
lve0200:

Hi all,

...

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

...


NO 

To add comments, please log in or register