Problems with basic code

To add comments, please log in or register
Will404
87
Will404  

Hi,

I'm having trouble with the following code:

int OnInit()
  {
   OrderSelect(0);
   Print(OrderGetString(ORDER_SYMBOL));
   Print(OrderGetString(ORDER_COMMENT));
   Print(OrderGetInteger(ORDER_MAGIC));
  
  //---
  return(INIT_SUCCEEDED);
  }

The Prints return empty when there are Pending Orders placed.  I don't know what I'm doing wrong.

Could someone help me?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Alain Verleyen
39019
Alain Verleyen  
Will404:

Hi,

I'm having trouble with the following code:

The Prints return empty when there are Pending Orders placed.  I don't know what I'm doing wrong.

Could someone help me?

Have you read the documentation ? OrderSelect() takes a ticket number as parameter. 0 is not a valid ticket number.

Will404
87
Will404  
Will404:

Hi,

I'm having trouble with the following code:

The Prints return empty when there are Pending Orders placed.  I don't know what I'm doing wrong.

Could someone help me?

Found the problem.. the input for OrderSelect() is the ticket and not the index number... I just had to change it for OrderGetTicket(0);


Will404
87
Will404  
angevoyageur:

Have you read the documentation ? OrderSelect() takes a ticket number as parameter. 0 is not a valid ticket number.

Also, I'm 4 min late to your reply.. Thanks for the input anyways! :)
Alain Verleyen
39019
Alain Verleyen  
Will404:
Also, I'm 4 min late to your reply.. Thanks for the input anyways! :)
Don't worry, you found it yourself which is even better.
To add comments, please log in or register