Extending MT4 with DLL.

 

Hi.

 

I'm new to Forex and MT4. I've had some success with demo account, but I feel  that trading manually is not my way.

I'm a software developer. I think I should use my programming skills in trading. My first approach was to learn MQL4

and try to write some advisor. 

 

After reading documentation, looking at others code and writing some stuff myself I can say only one thing: MQL4 is ugly.

Point by point:

  1. No user data types. No classes, no OOP at all, which is pretty much standard today, but to hell OOP, even no structures.
  2. No pointers. Hence inability to apply functional programming principles because there's no function pointer
    (map/reduce, higher order functions in general, etc...) and no awesome C/++ tricks with pointers.
  3. Odd limitations. 255 chars for string. Seriously? 
  4. Inability to contact with outer world. IPC? Haven't heard of it.
  5. Poor standard library
  6. Inability to set up own event loop. 
  7. DLLs can be imported, but having such limited amount of primitives and inability to pass callbacks
    limits that too.

Those are key points that make language so ugly. Correct me if I'm wrong.

I still don't have much experience with MQL (and I hope I won't if I'll get answer on my question),

but it looks terrible. Why did developers reinvent the wheel and why is it square after all is out of scope, but

still it would be interesting to find out because there's Lua (has limited standard libray, but extremely easily embedded

and has lots of libraries), Python (easily embedded too, also has insanely big standard library and gazillion of libraries

for literally everything you can think of), Ruby (easily embedded, small, provides unique metaprogramming features

and is pleasure to use) and some other options.

 

I have seen tries to embed Python into MT4, but it is 1) dead (last update in 2009), 2) unstable, lots of questions about why does

it crash, sometimes crashes are caused by 3rd party libraries that work fine in CPython interpreter, 3) after all I don't want to see

MQL at all. Not even a line of it.

 

So my question is: can I somehow extend MT4 with my own DLL?

 

Thanks. 

 
naquad:

Hi.

 

I'm new to Forex and MT4. I've had some success with demo account, but I feel  that trading manually is not my way.

I'm a software developer. I think I should use my programming skills in trading. My first approach was to learn MQL4

and try to write some advisor. 

 

After reading documentation, looking at others code and writing some stuff myself I can say only one thing: MQL4 is ugly.

mql4 is also quite old . . .  if you want OOP take a look at MT5 and mql5,  it should make you happy from a coding point of view but maybe not from a testing or trading point of view.
 
RaptorUK:
mql4 is also quite old . . .  if you want OOP take a look at MT5 and mql5,  it should make you happy from a coding point of view but maybe not from a testing or trading point of view.


I've seen MQL5 and I must say it looks much better than MQL4. But MT5 itself is not adopted by most of brokers. As I've understood MT5 has been around since 2010 and today, in 2013, it is still not that common.

I'm aware about back-testing issues of MT4, but there are 3rd party solutions covering back-testing. From trading point of view I can't say I've had some issues with MT4, its ok for manual trading

at least for my beginner level.

 

Bottom line is MT4 is ubiquitous, I doubt that'll change in nearest future or even a year. Correct me if I'm wrong, but using something other than MT4 means being locked on broker and one will

have issues with porting his experts to another terminal. 

 

There used to be video on how to write C++ dll for MT4 by Patrick s Nouvion, but I guess he move and delete it now from his website :(  

You can search C++ dll for MT4 or read my attachment in forex tsdI wrote that long time ago (year 2008) when I was still rookie, and I didn't update it, so it may confusing reading that a little.  

 

 
naquad: Odd limitations. 255 chars for string. Seriously?
There is no such limitation. There is only a 255 limit for string literals. For larger you must concatenate.
 
naquad:


I've seen MQL5 and I must say it looks much better than MQL4. But MT5 itself is not adopted by most of brokers. As I've understood MT5 has been around since 2010 and today, in 2013, it is still not that common.

I'm aware about back-testing issues of MT4, but there are 3rd party solutions covering back-testing. From trading point of view I can't say I've had some issues with MT4, its ok for manual trading

at least for my beginner level.

What is more important to you ?  being able to trade ( Broker support of the platform )  ?  or OOP coding ?  for the first use mql4 for the second use mql5 . . .  if you want both then you are greedy ;-)
 

Some more things that can slow down development.


1. No array bounds checking  - you have to do it yourself (ArraySize/ArrayRange etc) which is best practice anyway, but would be nice if there was a runtime error for this.

2. No uninitialized variable diagnostic. (although variables are initialized to zero, blank etc I'd still rather do this myself)

3. No unused variable diagnostic.

Would be nice if there was a tool available to do a few more compile time checks.

I was thinking for the latter two maybe  mq4 code through cpp to GCC- just to throw up some more diagnostics .....  OR a 'quick' perl script? 

but it may be more effort than its worth!

 
onewithzachy:

There used to be video on how to write C++ dll for MT4 by Patrick s Nouvion, but I guess he move and delete it now from his website :(  

You can search C++ dll for MT4 or read my attachment in forex tsdI wrote that long time ago (year 2008) when I was still rookie, and I didn't update it, so it may confusing reading that a little.  

 

Hello, Guys:

sorry to bother you in this way, I recently did a little test in calling dll(which also using another dll) in MT4...

And I met some troubles, I post a detail post...

https://forum.mql4.com/73835

Could you pls have a look?

I think you guys are the real experts here

Thankyou i  advance!

 
saji: Hello, Guys! sorry to bother you in this way, I recently did a little test in calling dll (which also using another dll) in MT4... And I met some troubles, I post a detail post... https://www.mql5.com/en/forum/160076
Could you pls have a look? I think you guys are the real experts here. Thank you i  advance!

Saji, please don't double post or "wake" old threads up, that are not even relevant and where several of the users are no longer active on the forum!

If on you own thread, you are not getting the answers you want, then consider doing more research of your own or hiring someone to either code it for you or teach you how to do it.

Reason: