function prints the order position where i expect it to print the order ticket number

 

My function prints the order position where i expect it to print the order ticket number. I followed the format from https://docs.mql4.com/trading/orderticket . It appears it should print the ticket number. Can one of my coding heros here please help me understand?

# Property Strict is not in my EA code. is that the problem? I do not see any reason that should affect it. 

 

 

 

bool CheckIfExtremeOrderExists ()     

{
  int i = OrdersTotal() -1;

  int ticketnumber;

  Print("Starting  CheckIfExtremeOrderExists () function….");
  
  for(; i >=0; i--)
   {
     if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) 
      {
       ticketnumber = OrderTicket();                   
       Print("selected ticket number to check if past threshold = " + ticketnumber);
    }  
  }
}
 
do you have an open order ?
 
c3po:

My function prints the order position where i expect it to print the order ticket number. . . .


Are you running the code in the Strategy Tester
 

Thirteen, Yes....... ooh i think i see that IS the ticket number in the tester,...... Thank you! im a new programmer and these little things i run into still.

 
qjol:
do you have an open order ?
Yes qjol. but only 1........ after 2nd order opens and closes, then it prints "2".   backtester order numbers. i see now. Thanks.
Reason: