• 概述
  • 评论
  • 评论 (12)
  • 新特性

Excel to Orders for MT5

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:

    1. Ref no (string) [ free format unique ref no , it is up to you. ]
    2. Symbol (string)
    3. Cmd (string) [ BUY , SELL  , BUY_LIMIT , SELL_LIMIT , BUY_STOP , SELL_STOP , BUY_STOP_LIMIT , SELL_STOP_LIMIT ]
    4. Volume (double)
    5. Price (double)
    6. Slippage (int)
    7. Stoploss (double)     0 (Zero):Means No Stoploss value 
    8. Takeprofit (double)  (Zero):Means No Takeprofit value 
    9. Comment (string)
    10. Magic (int)
    11. Stoploss Pips (int)     (Zero):Means No Stoploss value calculation
    12. Takeprofit Pips (int)  (Zero):Means No Takeprofit value calculation
    13. Stop Limit (double)   valid for only BUY_STOP_LIMIT , SELL_STOP_LIMIT orders.


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)

ref101;EURUSD;BUY;0.01;0;5;1.09;1.12;my eur comment;35600;200;200;

ref102;EURUSD;SELL;0.02;0;5;1.12;1.09;my eur comment;35601;300;300;

ref103;EURUSD;BUY_LIMIT;0.01;1.1;5;1.09;1.12;my eur comment;35602;400;400;

ref104;EURUSD;SELL_LIMIT;0.02;1.12;5;1.14;1.09;my eur comment;35603;500;500;

ref105;EURUSD;BUY_STOP;0.01;1.13;5;1.11;1.14;my eur comment;35604;600;600;

ref106;EURUSD;SELL_STOP;0.02;1.09;5;1.11;1.07;my eur comment;35605;700;700;

ref107;USDRUB;BUY;0.02;0;5;0;0;this ruble ;35606;10000;20000;

ref108;EURUSD;BUY_STOP_LIMIT;0.01;1.14430;5;0;0;my BUY_STOP_LIMIT;35607;0;0;1.1441

ref109;EURUSD;SELL_STOP_LIMIT;0.02;1.1411;5;0;0;my sell_STOP_LIMIT;35608;0;0;1.1414






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:

  1. Ref no (string)
  2. Symbol (string)
  3. Cmd (int)
  4. Volume (double)
  5. Price (double)
  6. Slippage (int)
  7. Stoploss (double)
  8. Takeprofit (double)
  9. Comment (string)
  10. Magic No(int)
  11. Stoploss Pips (int)      
  12. Takeprofit Pips (int)   
  13. Stop Limit (double)    
  14. Ticket (int)
  15. Error Code (int)
  16. 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);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;0;10016;Invalid stops

ref102;EURUSD;SELL;0.02;0;5;1.12;1.09;my eur comment;35601;300;300;0;0;10016;Invalid stops

ref103;EURUSD;BUY_LIMIT;0.01;1.1;5;1.09;1.12;my eur comment;35602;400;400;0;658439996;10009;Request executed

ref104;EURUSD;SELL_LIMIT;0.02;1.12;5;1.14;1.09;my eur comment;35603;500;500;0;0;10015;Invalid price

ref105;EURUSD;BUY_STOP;0.01;1.13;5;1.11;1.14;my eur comment;35604;600;600;0;0;10015;Invalid price

ref106;EURUSD;SELL_STOP;0.02;1.09;5;1.11;1.07;my eur comment;35605;700;700;0;658439997;10009;Request executed

ref107;USDRUB;BUY;0.02;0;5;0;0;this ruble ;35606;10000;20000;0;658440002;10009;Request executed

ref108;EURUSD;BUY_STOP_LIMIT;0.01;1.1443;5;0;0;my BUY_STOP_LIMIT;35607;0;0;1.1441;658440009;10009;Request executed

ref109;EURUSD;SELL_STOP_LIMIT;0.02;1.1411;5;0;0;my sell_STOP_LIMIT;35608;0;0;1.1414;658440014;10009;Request executed





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.


推荐产品
筛选:
无评论
版本 200.716 2020.07.17
1. Order Type selection field's data type is changed from Integer to string such as "BUY","SELL","BUY_STOP",...
2. New <Stoploss Pips> field is added. Stoploss value can be calculated with this field unless it is not ZERO.
3. New <Takeprofit Pips> field is added. Takeprofit value can be calculated with this field unless it is not ZERO.
4. New 2 order types are added namely BUY_STOP_LIMIT and SELL_STOP_LIMIT.
4. New <Stop Limit> field is added which can be used for only in BUY_STOP_LIMIT and SELL_STOP_LIMIT orders.