orderticket ?

To add comments, please log in or register
YousNmed
96
YousNmed  

hello.

i need your help, is there function return ticket number of an order open in a diferent pair?

it s like that if my EA is attached in "USDJPY" pair and i want get the price of "AUDUSD"pair i use the function Marketinfo .

exp: OrderSend("AUDUSD",OP_SELL,Lot,MarketInfo("AUDUSD",MODE_BID),3,0,0,"SS",Magic,0,Green);

qjol
3200
qjol  
int ticket = OrderSend("AUDUSD",OP_SELL,Lot,MarketInfo("AUDUSD",MODE_BID),3,0,0,"SS",Magic,0,Green);
& u have the ticket no.
YousNmed
96
YousNmed  
qjol:
& u have the ticket no.


thank s for your soon assure, but i was do the same and i have this message :

unknown ticket 98532738 for OrderClose function

qjol
3200
qjol  

can we c the code of your OrderClose() function ?

YousNmed
96
YousNmed  
qjol:

can we c the code of your OrderClose() function ?


that s ok tank you.for the second question you are always withe the right answers.
qjol
3200
qjol  
it's much more easier to point you out where the problem is, than start writing all the code from the begining, sorry
YousNmed
96
YousNmed  
qjol:
it's much more easier to point you out where the problem is, than start writing all the code from the begining, sorry


i m ok with you "learn me how i fish and don't give me a fish"

i m sorry but i have another question: is that wen i close the application(terminal) and i open it again the ticket number change and take zero as value?

if i declare variable as static value can solve the problem?

qjol
3200
qjol  

static var. doesn't gonna help u in this case use GlobalVariables or better way (if the terminal or windows crashed) File Functions

YousNmed
96
YousNmed  
qjol:

static var. doesn't gonna help u in this case use GlobalVariables or better way (if the terminal or windows crashed) File Functions


but my variable(ticket number) is int type and the GlobalVariables are different
qjol
3200
qjol  

so ?

William Roeder
22355
William Roeder  
izmnaari:


i m sorry but i have another question: is that wen i close the application(terminal) and i open it again the ticket number change and take zero as value?

if i declare variable as static value can solve the problem?

qjol:

static var. doesn't gonna help u in this case use GlobalVariables or better way (if the terminal or windows crashed) File Functions

Static only remembers while the EA is running. Global Variables are only written to disk if the terminal shuts down correctly. Power glitch/reboot, OS crash... will won't work.

Most EAs can recover buy using

    for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber() == magic.number              // my magic number
    &&  OrderSymbol()      == Symbol() ){               // and symbol

to get the information about open orders to recover. Especially ERR_NO_RESULT == 1, trade timeout=128, the order may or may not have been opened.

the file functions can write additional information about open orders in case of a restart.

To add comments, please log in or register