0

I try to read data from MetaTrader 4 with my app ( on vb.net )

I catch data with DDE but it is only bid, ask, high, low. So I must try another way.

I want to read realtime data for finished candles ( M5 and M15 etc. )

How can I read realtime candle data from MetaTrader 4?

Thanks in advance.

user3666197
  • 1
  • 6
  • 50
  • 92
Pisagor
  • 147
  • 1
  • 2
  • 16

1 Answers1

1

DDE-client pull-data mode

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.

MQL4 push-data mode

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.

MQL4 language distinguishes several modes of operation:

Each graph in MT4 may be associated with one so called Expert Advisor coded in MQL4 language

Each graph in MT4 may be associated with several Custom Indicators other MQL4 programme(s)

Each graph in MT4 may be associated with one Script a third type of MQL4 programme

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 ( a.k.a. 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 ).

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 ).

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 ( a.k.a. a tick ). Upon such event, your code gets control via an OnTick(){...} function an there you go, you may do whatever reasonable for your intended exports.

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.

Your MQL4 code can even co-operate with DLL-published API services, so technically speaking only your's imagination is the potential limit.

Further reading

MQL4 Reference / MQL4 programs

MQL4 Reference / Language Basics

MQL4 Reference / Language Basics / Functions / Description of External Functions

MQL4 Reference / Language Basics / Object-Oriented Programming / Polymorphism

Community
  • 1
  • 1
user3666197
  • 1
  • 6
  • 50
  • 92