
- 2011.02.01
- MetaQuotes Software Corp.
- www.mql5.com
this anwer do not really help,
i know the difference between position, order and deal
but how i can check, when the last position was closed?
amando
this is the code i use to check if was a deal within the last 5 minutes
HistorySelect(PeriodSeconds(PERIOD_M5),TimeCurrent()); //--- Wählt die Periode aus PERIOD_M% = letzten 5 Minuten int deals = 0; deals=HistoryDealsTotal(); //--- get ticket of the deal with the last index in the list Print(deals);
default is the value 0, if there was an deal the value count up
why does the value never go back to 0? it counts always up
amando
this is the code i use to check if was a deal within the last 5 minutes
default is the value 0, if there was an deal the value count up
why does the value never go back to 0? it counts always up
amando
i checked it out but i dont find a solution
the only think i want, is a value 0 when there was no order within the last 5 minutes
i modified the code a little bit
long EntryType; ulong Ticket; string DealSym; int DTS; int DTB; DTS = 0; DTB = 0; HistorySelect(0,TimeCurrent()); for(int i=HistoryDealsTotal()-1; i>=0; i--) { Ticket = HistoryDealGetTicket(i); DealSym = HistoryDealGetString(Ticket, DEAL_SYMBOL); EntryType = HistoryDealGetInteger(Ticket, DEAL_ENTRY); if(DealSym==_Symbol && EntryType==DEAL_ENTRY_OUT) { if(HistoryDealGetInteger(Ticket,DEAL_TYPE)==DEAL_TYPE_BUY) { DTB+=1; } } if(HistoryDealGetInteger(Ticket,DEAL_TYPE)==DEAL_TYPE_SELL) { DTS+=1; } Print("OldOrder"," value: ",DTS,DTB); }
but i didnt get any result
i get following value out, and this endless
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:10 OldOrder value: 12
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:10 OldOrder value: 11
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:10 OldOrder value: 01
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 43
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 43
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 33
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 23
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 22
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 12
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 11
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 01
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 53
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 43
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 43
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 33
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 23
2015.05.20 21:47:59 Core 3 2015.01.13 13:21:09 OldOrder value: 22
amando
You have first HistorySelect parameter wrong. Try this:
HistorySelect(TimeCurrent()-PeriodSeconds(PERIOD_M5),TimeCurrent()); //--- Wählt die Periode aus PERIOD_M% = letzten 5 Minuten int deals = 0; deals=HistoryDealsTotal(); //--- get ticket of the deal with the last index in the list Print(deals);
Thanks Dr. Trader

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
does anyone have an idea how how i can select an old order?
in my mind is, to check how long was the last order ago in the currency pair
as example, before i set an order, i will check out, if there was an order within the last 5 minutes.
does anyone have a code idea for me?
Amando