Transaction results specifying a specific date and time

To add comments, please log in or register
12027780
25
12027780  
In the EA of MT4, I want to extract the transaction results by specifying a specific date and time in the past.

As a result of writing the following code,
OrderOpenTime ()> "2019.12.10" will be extracted,
OrderOpenTime ()> "2019.12.15" is not extracted
Some cases cannot be extracted by date.
* Transactions occur at 12.10 and 12.15

for (int a = 1; a <= OrdersHistoryTotal (); a ++) {
if (OrderSelect (a, SELECT_BY_POS, MODE_HISTORY) == false) break;

if ((OrderProfit ()> 0 || OrderProfit () <0) && (OrderOpenTime ()> = "2019.12.15" && OrderOpenTime () <= "2019.12.31")) {

(Specify the transaction results you want to extract by specifying conditions)

}
}


I would be grateful if you could give advice on this factor and improvement.
andrew
433
andrew  
12027780:
In the EA of MT4, I want to extract the transaction results by specifying a specific date and time in the past.

As a result of writing the following code,
OrderOpenTime ()> "2019.12.10" will be extracted,
OrderOpenTime ()> "2019.12.15" is not extracted
Some cases cannot be extracted by date.
* Transactions occur at 12.10 and 12.15



I would be grateful if you could give advice on this factor and improvement.

If I'm having trouble extracting info I break it down to a base level, so at least the code is getting the values I expect....

In this case I'd start with a list of orders in profit, then check it against the actual values in the terminal.Then, expand the code to filter what you need, and consider whether you need to use StringToTime(..) TimeHour(..) etc...

string txt;
for(int x=1;x<OrdersHistoryTotal();x++)
if(OrderSelect(x,SELECT_BY_POS,MODE_HISTORY))
  if(OrderProfit()>0){
   txt=StringConcatenate(txt,OrderTicket(),",",OrderSymbol(),",",OrderProfit());
   txt=StringConcatenate(txt,",",OrderOpenTime(),"\n") ;
   }
 
  Comment(txt);

/* (my history on screen)
8614215,GBPNZD,0.09,2019.12.23 09:45:51
8614219,GBPNZD,0.24,2019.12.23 09:47:00
8614225,GBPNZD,0.08,2019.12.23 09:47:52
*/
paul selvan
626
paul selvan  
12027780:

"2019.12.10" 
"2019.12.15" 

correct date format

To add comments, please log in or register