Excel to Orders for MT5
- Utilitys
- Volkan Yurci
- Version: 210.623
- Aktualisiert: 23 Juni 2021
Why do you need this script?
If you have lots of analyzed orders in Excel where need to be placed on MT5 , this script will be very handy and time saver for you.
All your orders are processed in seconds and your order's results are written to an output file.
How it works?
1. Prepare .xls file and save it as
...MQL5\Files\Excel_to_Orders.csv
Input csv structure:
- Ref no (string) [ free format unique ref no , it is up to you. ]
- Symbol (string)
- Cmd (string) [ BUY , SELL , BUY_LIMIT , SELL_LIMIT , BUY_STOP , SELL_STOP , BUY_STOP_LIMIT , SELL_STOP_LIMIT ]
- Volume (double)
- Price (double)
- Slippage (int)
- Stoploss (double) 0 (Zero):Means No Stoploss value
- Takeprofit (double) 0 (Zero):Means No Takeprofit value
- Comment (string)
- Magic (int)
- Stoploss Pips (int) 0 (Zero):Means No Stoploss value calculation
- Takeprofit Pips (int) 0 (Zero):Means No Takeprofit value calculation
- Stop Limit (double) valid for only BUY_STOP_LIMIT , SELL_STOP_LIMIT orders.
- Expire Datetime (string) valid for only Pending Orders , 9999.mm.dd hh:mm : means NO Expire Datetime.
Input Sample:
Ref no (String);symbol (string);cmd (int);volume (double);price (double);slippage (int);stoploss (double);takeprofit (double);comment (string);magic (int);slPips (int);tpPips (int);stopLimit(double);expireDatetime (string)
ref101;EURUSD;BUY;0.01;0;5;1.09;1.12;my eur comment;35600;200;200;0;2000.01.01 11:11
ref102;EURUSD;SELL;0.02;0;5;1.12;1.09;my eur comment;35601;300;300;0;2000.01.01 11:11
ref103;EURUSD;BUY_LIMIT;0.01;1.1;5;1.09;1.12;my eur comment;35602;400;400;0;9999.01.01 11:11
ref104;EURUSD;SELL_LIMIT;0.02;1.12;5;1.14;1.09;my eur comment;35603;500;500;0;2000.01.01 11:11
ref105;EURUSD;BUY_STOP;0.01;1.13;5;1.11;1.14;my eur comment;35604;600;600;0;2000.01.01 11:11
ref106;EURUSD;SELL_STOP;0.02;1.09;5;1.11;1.07;my eur comment;35605;700;700;0;2021.07.17 21:31
ref107;USDRUB;BUY;0.02;0;5;0;0;this ruble ;35605;5000;7000;0;2000.01.01 11:11
2. Run
Excel to Orders
script on any currently opened chart window in your terminal.
After initiating the script , your records are processed one by one and result .csv file is created in the same sub-directory of MT5
...MQL5\Files\Excel_to_Orders_Results.csv
Result csv structure:
- Ref no (string)
- Symbol (string)
- Cmd (int)
- Volume (double)
- Price (double)
- Slippage (int)
- Stoploss (double)
- Takeprofit (double)
- Comment (string)
- Magic No(int)
- Stoploss Pips (int)
- Takeprofit Pips (int)
- Stop Limit (double)
- Expire Datetime (string)
- Ticket (int)
- Error Code (int)
- Error Description (string)
Last 3 columns are appended at the end of your input record.
Output Sample:
Ref no (String);symbol (string);cmd (int);volume (double);price (double);slippage (int);stoploss (double);takeprofit (double);comment (string);magic (int);slPips (int);tpPips (int);stopLimit(double);expireDatetime (string);Ticket (int);Error code (int);Error description (string)
ref101;EURUSD;BUY;0.01;0;5;1.09;1.12;my eur comment;35600;200;200;0;2000.01.01 11:11;0;10016;Invalid stops
ref102;EURUSD;SELL;0.02;0;5;1.12;1.09;my eur comment;35601;300;300;0;2000.01.01 11:11;0;10016;Invalid stops
ref103;EURUSD;BUY_LIMIT;0.01;1.1;5;1.09;1.12;my eur comment;35602;400;400;0;9999.01.01 11:11;1018720324;10009;Request executed
ref104;EURUSD;SELL_LIMIT;0.02;1.12;5;1.14;1.09;my eur comment;35603;500;500;0;2000.01.01 11:11;0;10015;Invalid price
ref105;EURUSD;BUY_STOP;0.01;1.13;5;1.11;1.14;my eur comment;35604;600;600;0;2000.01.01 11:11;0;10015;Invalid price
ref106;EURUSD;SELL_STOP;0.02;1.09;5;1.11;1.07;my eur comment;35605;700;700;0;2021.07.17 21:31;1018720330;10009;Request executed
ref107;USDRUB;BUY;0.02;0;5;0;0;this ruble ;35605;5000;7000;0;2000.01.01 11:11;0;10016;Invalid stops
3. You may open your result file
...MQL5\Files\Excel_to_Orders_Results.csv
with excel to view the return codes of your order records.
Please report any bug issue or free of charge development request (volkanyurci@gmail.com) upon your needs.
Excellent product, super practical, easy to understand. It works perfectly. Thanks to the author. It really helps the operation a lot. Thank you 5*