简体   繁体   English

如何从vb.net实时从MetaTrader4终端(MT4)读取蜡烛数据

[英]How to read candle data from a MetaTrader4 Terminal ( MT4 ) from vb.net in realtime

I try to read data from MetaTrader 4 with my app ( on vb.net ) 我尝试使用我的应用程序( vb.net )从MetaTrader 4读取数据

I catch data with DDE but it is only bid, ask, high, low . 我使用DDE捕获数据,但它只是bid, ask, high, low So I must try another way. 所以我必须尝试另一种方式。

I want to read realtime data for finished candles ( M5 and M15 etc. ) 我想读取成品蜡烛的实时数据( M5M15等)

How can I read realtime candle data from MetaTrader 4? 如何从MetaTrader 4中读取实时蜡烛数据?

Thanks in advance. 提前致谢。

DDE-client pull-data mode DDE客户端拉取数据模式

DDE -model allows external process to ask a DDE-server ( which may be enabled to run inside MT4 ) to respond to external request(s) independently of the other MetaTrader Terminal operations. DDE允许外部进程独立于其他MetaTrader终端操作来请求DDE服务器(可以使它运行在MT4内)响应外部请求。

MQL4 push-data mode MQL4推送数据模式

Much better control of the realtime performance, scope and other features one may achieve by active push-data policy, where MetaTrader Terminal software operates it's internal MQL4 -code-execution-factory, which runs appropriate push-data facilitation towards any external process. 主动推送数据策略可以更好地控制实时性能,范围和其他功能,其中MetaTrader终端软件在其内部运行MQL4代码执行工厂,该工厂对任何外部流程运行适当的推送数据服务。

MQL4 language distinguishes several modes of operation: MQL4语言区分几种操作模式:

Each graph in MT4 may be associated with one so called Expert Advisor coded in MQL4 language 在MT4每个图表可以与一个所谓的相关Expert Advisor 在MQL4语言编码

Each graph in MT4 may be associated with several Custom Indicators other MQL4 programme(s) MT4中的每个图形可能与其他MQL4程序的 几个 Custom Indicators相关联

Each graph in MT4 may be associated with one Script a third type of MQL4 programme MT4中的每个图形都可以与一个Script ,第三种MQL4程序相关联

Using this, one may fulfill any kind of live-export needs, including a low-latency, real-time data publication of an OHLCV+T + actual Ask - Bid ( aka spread ) data for a just closed Bar ( be it M1 , M5 , M15 or any other form of synthetic time-framing of the market events' flow ). 使用此功能,可以满足任何形式的实时导出需求,包括低延迟的OHLCV+T实时数据发布OHLCV+T刚刚封闭的Bar实际Ask - Bid (又称价差)数据(即M1M5M15或市场事件流的任何其他合成时间框架)。

Principle 原理

MQL4 programs use syntactically a c-class programming language ( be carefull, MQL4 does not mimick c-lang and is specific in many ways, but is equipped with almost all syntax-constructors you may expect in c-lang ). MQL4程序在语法上使用c类编程语言(请注意, MQL4不会模仿c-lang并且在很多方面都是特定的,但是几乎配备了您可能期望在c-lang使用的所有语法构造函数)。

Conceptually, your Expert Advisor type-of-code may export any data, based on one condition that all programs of this type expect ... it must receive a message from FOREX Market ( from MetaTrader Server, operated on your Broker side ) about a "new"- QUOTE ( aka a tick ). 从概念上讲,您的Expert Advisor代码类型可以基于所有此类程序期望的一种条件来导出任何数据...它必须从FOREX Market(从MetaTrader Server,在您的经纪人一方操作)接收有关以下内容的消息: “ new” QUOTE (又称对号)。 Upon such event, your code gets control via an OnTick(){...} function an there you go, you may do whatever reasonable for your intended exports. 发生此类事件时,您的代码将通过OnTick(){...}函数得到控制,然后执行此操作,就可以对预期的导出执行任何合理的操作。

In case you want to use a Script -model , there you need not wait till Monday start of the FOREX Markets, because this type of code gets control once it is initiated via an OnStart(){...} function, without any synchronicity with Market Events' flow. 如果您要使用Script ,则无需等到周一外汇市场开始,因为一旦通过OnStart(){...}函数启动该类型的代码,它便会获得控制权,而不会出现任何同步市场活动的流程。

Your MQL4 code can even co-operate with DLL-published API services, so technically speaking only your's imagination is the potential limit. 您的MQL4代码甚至可以与DLL发布的API服务配合使用,因此从技术上来说,只有您的想象力才是潜在的限制。

Further reading 进一步阅读

MQL4 Reference / MQL4 programs MQL4参考/ MQL4程序

MQL4 Reference / Language Basics MQL4参考/语言基础

MQL4 Reference / Language Basics / Functions / Description of External Functions MQL4参考/语言基础/函数/外部函数的描述

MQL4 Reference / Language Basics / Object-Oriented Programming / Polymorphism MQL4参考/语言基础/面向对象的编程/多态

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM