Hi. I'm still trying to get the hang of the MT4 programming. My background is C++.
I open the order like this inside the EA.
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Ask+500*Point,0,name,MagicNumber,0,Red);
Then I want to close that order and that order only.
So I use
OrderClose(MagicNumber,OrderLots(),Ask,Slippage,Red);
This doesn't work for me, though. What am I doing wrong? Thanks.MagicNumber doesn't identify the order for OrderClose(), you must use the ticket number : OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
My dilemma is what if I have the EA working on 7 different currencies. How does it know that orderticket is the right one?
My dilemma is what if I have the EA working on 7 different currencies. How does it know that orderticket is the right one?
just use :
if (( OrderMagicNumber() == megic) && (OrderSymbol() == Curr))
to distinguish it from others
just use :
if (( OrderMagicNumber() == megic) && (OrderSymbol() == Curr))
to distinguish it from others? What is "megic" and "curr" ? You mean test to see if they are the right ones? How exactly would I do that. I'm not very familiar with MT4.
? What is "megic" and "curr" ? You mean test to see if they are the right ones? How exactly would I do that. I'm not very familiar with MT4.
magic is your magic number that u used when open the order. Curr is the currency that u want to check. you can use Symbol() instead
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi. I'm still trying to get the hang of the MT4 programming. My background is C++.
I open the order like this inside the EA.
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Ask+500*Point,0,name,MagicNumber,0,Red);
Then I want to close that order and that order only.
So I use
OrderClose(MagicNumber,OrderLots(),Ask,Slippage,Red);
This doesn't work for me, though. What am I doing wrong? Thanks.