Download MetaTrader 5
To add comments, please log in or register
They are already making profit using the Market. You can join them!
Brian Kester
794
Brian Kester 2014.06.11 14:22 

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);
    }  
  }
}
qjol
3243
qjol 2014.06.11 14:32  
do you have an open order ?
GreenMoney
379
GreenMoney 2014.06.11 14:35  
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
Brian Kester
794
Brian Kester 2014.06.11 14:42  

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.

Brian Kester
794
Brian Kester 2014.06.11 14:49  
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.
/
To add comments, please log in or register