int ticket = OrderSend("AUDUSD",OP_SELL,Lot,MarketInfo("AUDUSD",MODE_BID),3,0,0,"SS",Magic,0,Green);& u have the ticket no.
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.
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?
static var. doesn't gonna help u in this case use GlobalVariables or better way (if the terminal or windows crashed) File Functions
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
so ?
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?
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.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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);