Mt4 Api - page 3

 

Reading Data from a Web site. InternetReadFile() API

Hi. In the new post of my blog I let you a metatrader library that allows you to read data from a Web Page.

Its use it is fully commented through an example with images.

I hope you like it and I wait for your comments

Best regards,

Mestize

Handling Forex with Metatrader

 

metatrader API

Hi All,

Can I use metatrader API to create custom software using VB.NET which display charts and all the same features in metatrader4.

If possible , please provide me the details and code to develop custom software.

Thanks in advance.

 
udalcse:
Hi All,

Can I use metatrader API to create custom software using VB.NET which display charts and all the same features in metatrader4.

If possible , please provide me the details and code to develop custom software.

Thanks in advance.

Hi,

The Metatrader API is for brokers. You can't use it to mimic MT4 functionality.

 

metatrader server ea + erlange/lfe

I was wondering if anyone out there has though of/or knows of a metatrader server ea which which one could connect to and control all functions of metatrader. I was thinking that an erlang server could provide a frontend (actually, written in LFE, lisp flavored erlang, since erlang syntax is horrible in my opinion!) which would allow critical common tasks, like OCO orders, hedging orders (for usa brokers). And then eas could be run and interact with this LFE frontend hopefully with high fault tolerance protection.

Anyone? I personally believe that the metatrader world could use a programming language other than mql4.

 
Storkle:
Anyone? I personally believe that the metatrader world could use a programming language other than mql4.

Sure! .. it is called MQL5... surprise surprise

 

yeah, c++ like languages everyone loves ! Really useful for fast prototyping and dynamic code testing

On the other hand, clojure looks more suitable...

 
Storkle:
yeah, c++ like languages everyone loves ! Really useful for fast prototyping and dynamic code testing On the other hand, clojure looks more suitable...

why the clojure looks more suitable?...

 

You mean more than mql4/mql5 or erlang? First, practically any functional language would be better than mql4 and mql5 (well, maybe not.. more on that later). The significant feature that functional languages have over mql4/mql5 is that you dont have to wait to compile things, and you can actually test a single function separately with little effort by using the interactive command prompt, instead of having to wait to see if an ea function works (or laboriously creating a separate test for each function in a separate ea/script). Not to mention mql, as a language, moves quite slowly. And much else, see below

Clojure looks more suitable that erlang because

(1) lisp syntax is better than that of erlang and allows abstraction

(2) it was designed with high concurency in mind, and it achieves that by having most data immutable - however, you can use modifiable variables via an easy mechanism (STM is the general concept). Immutable data naturally leads to programs which dont have to worry much about lock details, leading to more robustness. This STM makes clojure more suitable than erlang on a personal computer - in erlang you cant modify any variables once they have been set, you have to copy them again.

(3) Clojure runs on the java virtual machine - easy access to any java library and portable!

(4) Abstraction - this is important, in order to have easy programs be written easily. Macros in lisp allow this. I wont get into this, but for example, you could write something like this, which utilizes several macros.

(ea parabolic-ts (order)

"define trailing stop ea - if parabolic sar is less one time before is less than todays price"

(let [psar (psar '(.1 .1) 1)]

(if (buy? order) (if (< psar (close)) (modify order :sl psar ))

(sell? order) (if (> psar (close)) (modify order :sl psar)))))

(ea ma-cross (period1 perio2)

"moving average crossover"

(when (and (> (mva period1 1) (mva period2 1))

(< (mva period1 2) (mva period2 2)))

(javax.swing.JOptionPane/showMessageDialog nil "moving average crossover!")))

;;w/env defines an environment which functions like (mva ...) access - no need to pass around, once code exits this block, environment is reset to what it was before

(w/env (:symbol "USDJPY" :timeframe +D1+) (run-ea 'parabolic-ts a-random-order-we-have) (run-ea 'ma-cross 25 50))

I actually already have a simple socket library in mql4 which will accept connections and will place orders, get some indicator data, account balance data, based on strings you send it. Ive also create a common lisp library which sort of allows something similar to the above, but i found that I wanted to modularize part of my code into a separate fronted server, to which any language in any program could connect to. And i thought, well, lisp isn't really suited for this as theres not much library support (and because it wasnt designed to be robust like erlang was. And then, since I dont want to program in erlang, i finally thought of clojure, which i have played with before. So, i thought i would switch to clojure but first ask if anyone but me has ever desired anything other than mql4/mql5! (so if anyones interested, i could point them to the online repository to help out).

In terms of speed, the only speed you have to worry about is the speed of placing orders/modifying orders and getting the latest 0th price/indicator stream data (everything else can be cached, for most indicators which dont overwrite past data). And sockets + functional language is plenty fast for this. Furthermore, if one had access to many indicators already implemented in java/clojure, one would only have to retrieve the 0th price stream data. All the other indicators get computed clojure side and past price data goes into database (thats where easy java interop comes into play - easy to use databases!)

Ok, thats all i can think of for now!

 
Storkle:
You mean more than mql4/mql5 or erlang? Ok, thats all i can think of for now!

i can't see any advantages . Dukas copy implements Java, FXCM and others now uses C# programming language to implement the core system of indicators and ea's. Meta-quotes for now have to stay with C++ Syntax as the base system is an API.

Although respect your thoughts but i am sure somewhere there is something preventing these firms to go with this. Send them your thoughts!

 

thats cool Its not actually a 'send them your thoughts' thing, its an implement yourself thing. Welll, i guess i'll be doing functional programming eas with access to java (for free, no need for special apis unless metatrader becomes non-free!) while others will be content with mql4.

Reason: