ShaKerZ Posted August 1, 2009 Report Share Posted August 1, 2009 I've a robot that was not magic number. How to add this ? What's the mq4 code ? Quote Link to comment Share on other sites More sharing options...
copycat Posted August 1, 2009 Report Share 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 Link to comment Share on other sites More sharing options...
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.