请观看如何免费下载自动交易

有趣的脚本?
因此发布一个链接 -
让其他人评价

喜欢这个脚本? 在MetaTrader 5客户端尝试它

显示:
498
等级:
投票: 21
已发布:
2017.11.16 10:03
已更新:
2018.02.28 16:06

"Pending orders UP (向上挂单)" 脚本程序在高于当前价格处设置多个挂单组成网格。


输入参数

  • Gap for pending orders UP from the current price (in pips) - 当前价格与第一个挂单之间的距离.
  • Step between orders UP (in pips) - 挂单之间的距离.
  • Type of pending orders UP - 挂单的类型 (可以是止损买入或者限价卖出).
  • UP quantity - 需要设置的挂单数量.
  • Lots - 每个挂单的交易量.
  • Stop Loss (in pips) - 止损值.
  • Take Profit (in pips) - 获利值.

该脚本通过使用异步交易操作来确保最快地发送交易请求来设置挂单:

m_trade.SetAsyncMode(true);

这里是一个发送5个挂单请求的例子:

2017.08.28 08:50:22.246 Scripts script Pending orders UP (AUDCAD,Daily) loaded successfully
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99262 sl: 0.99011 tp: 0.99462
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99412 sl: 0.99161 tp: 0.99612
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99562 sl: 0.99311 tp: 0.99762
2017.08.28 08:50:24.096 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99712 sl: 0.99461 tp: 0.99912
2017.08.28 08:50:24.096 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99862 sl: 0.99611 tp: 1.00062
2017.08.28 08:50:24.097 Scripts script Pending orders UP (AUDCAD,Daily) removed

五个挂单是在1毫秒之内发送的!

这里是完整报告,从脚本的开始到它被删除 (发送第一个订单的时间是 2017.08.28 08:50:24.095):

2017.08.28 08:50:22.246 Scripts script Pending orders UP (AUDCAD,Daily) loaded successfully
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99262 sl: 0.99011 tp: 0.99462
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99412 sl: 0.99161 tp: 0.99612
2017.08.28 08:50:24.095 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99562 sl: 0.99311 tp: 0.99762
2017.08.28 08:50:24.096 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99712 sl: 0.99461 tp: 0.99912
2017.08.28 08:50:24.096 Trades  '6121033': buy stop 0.01 AUDCAD at 0.99862 sl: 0.99611 tp: 1.00062
2017.08.28 08:50:24.097 Scripts script Pending orders UP (AUDCAD,Daily) removed
2017.08.28 08:50:24.169 Trades  '6121033': accepted buy stop 0.01 AUDCAD at 0.99262 sl: 0.99011 tp: 0.99462
2017.08.28 08:50:24.170 Trades  '6121033': order #164991202 buy stop 0.01 / 0.01 AUDCAD at market done in 107.907 ms
2017.08.28 08:50:24.170 Trades  '6121033': accepted buy stop 0.01 AUDCAD at 0.99412 sl: 0.99161 tp: 0.99612
2017.08.28 08:50:24.174 Trades  '6121033': order #164991203 buy stop 0.01 / 0.01 AUDCAD at market done in 78.513 ms
2017.08.28 08:50:24.174 Trades  '6121033': accepted buy stop 0.01 AUDCAD at 0.99562 sl: 0.99311 tp: 0.99762
2017.08.28 08:50:24.175 Trades  '6121033': order #164991204 buy stop 0.01 / 0.01 AUDCAD at market done in 79.283 ms
2017.08.28 08:50:24.175 Trades  '6121033': accepted buy stop 0.01 AUDCAD at 0.99712 sl: 0.99461 tp: 0.99912
2017.08.28 08:50:24.175 Trades  '6121033': accepted buy stop 0.01 AUDCAD at 0.99862 sl: 0.99611 tp: 1.00062
2017.08.28 08:50:24.175 Trades  '6121033': order #164991205 buy stop 0.01 / 0.01 AUDCAD at market done in 79.516 ms
2017.08.28 08:50:24.175 Trades  '6121033': order #164991206 buy stop 0.01 / 0.01 AUDCAD at market done in 79.565 ms

当设置最后一个挂单被确认的时间是 2017.08.28 08:50:24.175. 所有操作总共花费的时间只有 80 毫秒那么少!

在脚本运行的开始,要检查指定交易量正确性:

//+------------------------------------------------------------------+
//| 脚本程序起始函数                         |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   if(InpLots<=0.0)
     {
      Print("\"Lots\" 不能小于或者等于0");
      return;
     }
//---
   if(!m_symbol.Name(Symbol())) // 设置交易品种名称
      return;
   if(!RefreshRates())
      return;

   string err_text="";
   if(!CheckVolumeValue(InpLots,err_text))
     {
      Print(err_text);
      return;
     }
//---

本文译自 MetaQuotes Software Corp. 撰写的俄文原文
官方代码: https://www.mql5.com/ru/code/19024

历史交易与订单 历史交易与订单

'历史交易与订单(History Deals and Orders)'脚本程序显示了在给定时间段的交易历史中的交易和订单所有属性。

Expert Expert

一个用于读取/写入任意EA交易参数的开发库。

Pending orders DOWN Pending orders DOWN

这个脚本程序会设置多个低于当前价格的挂单。

Burg Extrapolator Burg Extrapolator

本EA交易使用Burg的方法来进行线性预测。