文章 "EA 交易中采用OnTrade() 函数处理交易事件"

 

新文章 EA 交易中采用OnTrade() 函数处理交易事件已发布:

MQL5提供了海量的创新,其中就包括使用各种类型的事件(计时器事件、交易事件、自定义事件等)。有了处理事件的能力,您就能够创建全新类型的自动与半自动交易程序。我们会在本文中一起学习交易事件,并针对OnTrade()函数编写一些处理交易事件的代码。

利用 MQL 编写“EA 交易”的任何交易者,或早或晚都会面临报告其“EA 交易”如何起作用的必要性。也可能需要实现“EA 交易”行动相关的短信或电子邮件通知。不管哪种情况,我们都得“捕捉”市场中发生特定事件或某个“EA 交易”执行的行动,并通知用户。

我会用本文为您讲解可以如何实现交易事件的处理,并提供我的实现。

我们拟于本文中处理下述事件:

  • 持仓
    1. Open(开仓)
    2. Add(增持)
    3. Modify (修改持仓)(更改“止损”与“获利”)
    4. Reverse(反向开仓)
    5. Close entire position(完全平仓)
    6. Close part of position(部分平仓)
  • 挂单
    1. Place(下挂单)
    2. Modify(修改挂单)

图 1. 警报

作者:KlimMalgin

 
  • 持仓
    1. Open(开仓)
    2. Add(增持)
    3. Modify (修改持仓)(更改“止损”与“获利”)
    4. Reverse(反向开仓)
    5. Close entire position(完全平仓)
    6. Close part of position(部分平仓)
  • 挂单
    1. Place(下挂单)
    2. Modify(修改挂单)

 建议先翻译,https://www.mql5.com/en/articles/211  Orders, Positions and Deals in MetaTrader 5

 先弄清上面的6+2里面对应Orders, Positions and Deals 的那一个!

Orders, Positions and Deals in MetaTrader 5
Orders, Positions and Deals in MetaTrader 5
  • 2011.02.01
  • MetaQuotes Software Corp.
  • www.mql5.com
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
原因: