Why do I need this?
If you use Expert Advisors (EA) and you want to be able to add orders that the EA will track and manage, you need this script.
If you simply add a pending or market order, the EA will not manage that order because the magic number will not be the same. Magic numbers are used by EAs to track orders and positions that are directly related to that EA.
What does it do?
After you drag and drop this script on your chart, you specify the inputs (see the screenshot), and it will add a pending order with the magic number you specify.
The script will also tell you all the magic numbers for current open orders, so you can tell what magic number you need to use (see the screenshot).
How do I use it?
Drag and drop it on the chart. The input window is shown. Select your inputs and press OK.
The text will be displayed on the chart while the script is working. A result is shown in a second.
A pending order will be placed at the price where you dropped the script. Entry, target and stop are placed. You then drag the 3 lines to where you want them using the MT4 chart "One Click Trading" option.
You will need to know what the magic number is for the EA you are using for this to work properly. If you do not know what the magic number is, simply drop this script on the chart, then cancel pending order, then go to the Experts tab and read the print out. All of the open order magic numbers are printed out. Then you can figure out what magic number you need to use and enter it in the inputs for this script once you drop it on the chart.
- Order lots - the lot size of the order.
- Magic Number - the magic number you want to assign to the order.
- Order Comment - the order comment, the magic number will be added to the comment.
- Use Target - if true, a target will be used, you can drag this to anywhere you want once the order is placed.
- Use Stop - if true, a stop loss will be used, you can drag this to anywhere you want once the order is placed.
- Order_Type - "Buy Order" or "Sell Order". If you enter a Buy Order, you must drop the script below price or an error will be displayed.