trading - MQL4:如何获取经济日历的事件值?

标签 trading algorithmic-trading mql4 metatrader4 forex

如何使用 MQL4 获取经济公告的最新发布值与另一个名为 x 的变量进行比较?

我需要将获取的数据(变量 x )与手动输入变量 y 进行比较170000 的值。

如果x > y ,执行一个函数,并且如果 x < y执行不同的函数。

extern int x = 170000;

extern int y = ...; //Fetch latest value of economic announcement 
                    //to compare to extern int x

void OnStart()
  {

  if(x>y){ 
      //Executes a function
  } 

  else 
  if (x<y){
      //Executes a different function
  }

  }

使用extern int ,如果我设置 x = 1x = 3 (或任何其他数字)手动,脚本工作正常。我只是想知道是否 extern int将是获取值并将其转换为数字的合适方法,以便我可以通过 x > y 比较它们。或x < y

我从另一个网站找到了一个 SLOC,其中有人想要将整个经济日历导入到他们的算法中(尽管事实上我只需要一个最新值),我认为将其包含在这个问题中可能有点有用。它从 .csv 导入数据文件,所以也许我也可以尝试这个方法。 SLOC:

extern string HtmlAdress = "http://www.dailyfx.com/calendar/Dailyfx_Global_Economic_Calendar.csv";

我知道延迟将是此方法的一个突出问题,但这仍然可以实现吗?

最佳答案

可以实现吗?是:

如何?

<强> 1. 找到稳定可靠的发布数据来源(发布延迟、数据有效性)

<强> 2. 检查他们如何/是否操作某种技术传播或远程访问宏观数据的手段( RSS -数据源,而不仅仅是新闻专线、平面/“ondulated"普通 html 网络表、静态命名文件更新等)

<强> 3. 实现一个代理扫描器,它将实现 (2) 自主执行 MetaTrader 终端 的外部操作及其内部代码执行单元。

<强> 4. 装备 (3) 具有与协议(protocol)无关的、多平台的、与 MT4 在线通信的集成就绪方式 进程( ZeroMQnanomsg 等)

<强> 5. 实现 MT4 ExpertAdvisor代码包括快速高效的通信交换和空闲握手 proxy-scanner (3)

工具?

经过多年大规模系统集成的实践,最有效的方法是快速原型(prototype)开发 (2+3+4) 一个python-2.x是执行此操作的合理选择并且 ZeroMQnanomsg (4+5) 提供相当广泛的移植框架


例子?是:

https://www.dailyfx.com/calendar/index_iframe.html?tz=2&sort=date&week=today&eur=true&usd=true&jpy=true&gbp=true&chf=true&aud=true&cad=true&nzd=true&cny=true&high=true&medium=true&low=true

Brings an algorithmically parse-able html-table as a source of the needed value(s):

<tr class ="e-cal-row" id ="eventrow10" onClick ="commentOnOff('...xml',10,'english')"> <td></td> <td>10:00</td> <td><div class="flag-32-eur"></div></td> <td width="100%">EUR German IFO - Expectations (AUG)</td> <td class="evImportance medium"><span></span></td> <td style="color:red" nowrap="nowrap"> <span style="color:red">100.1</span></td> <td nowrap="nowrap">102.4</td> <td style="color:red" nowrap="nowrap"> <span style="color:red">102.2</span></td> <td align="right"><div class="arrow"></div></td> </tr>

有风险吗?是:

  • 更多的组件意味着更多的地方可以实现错误恢复策略

  • 解决方案最终取决于 (2) 的状态(可以实现1+1更新源)

  • 最后, (2) 中的任何微小变化 使您的处理线停止并强制您的实现循环回 (2) 重新再次开始重新工程、重新实现和重新测试步骤。

关于trading - MQL4:如何获取经济日历的事件值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39142966/

相关文章:

api - Binance的dapi(硬币 future api)中使用的符号是什么?

Python 多处理 : Start/stop processes on server

python - 如何在滚动窗口中应用 Python 中的赫斯特指数

r - R中的布林带

python - 如何将数据从 MetaTrader 4/5 终端发送到外部服务器?

python - spyder中的RSI使用excel中的数据

C++ : Avoid lot of boolean variable for multiple verification conditions in trading app

ubuntu - 通过 wine metaeditor.exe 通过命令行编译 MQL4

交易资源的算法

python - 使用自定义指标和 C++ DLL 时出现访问冲突读取错误和 MT4 崩溃