ShaKerZ Posted August 1, 2009 Report Posted August 1, 2009 I've a robot that was not magic number. How to add this ? What's the mq4 code ? Quote
copycat Posted August 1, 2009 Report Posted August 1, 2009 Re: Please help me ! I've a robot that was not magic number. How to add this ? What's the mq4 code ? At the beginning of your EA, add this line int MagicNumber=112233; // any number you like Then when you try to open trades, you must issue command like ticket=OrderSend(Symbol(),BUY_OR_SELL,Lots,Price,Slippage,SL,TP,Comment,MagicNumber,OrderValidity,Color); Now, each position opened has the magic number defined as above. So very time you refer to your position, you need to make sure it has the same MagicNumber by using OrderMagicNumber()==MagicNumber as part of your expression. eg . if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber()==MagicNumber)) Hope this helps... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.