Interview with Stanislav Starikov: Features of New MQL5

 

The new platform, MetaTrader 5, has been developed for a number of months. A new language for programming of trading strategies, MQL5, has been written, too. Stanislav Starikov (stringo), the leading developer of the language, tells in his interview about special features of MQL5 and about how it differs from MQL4:



 

1.

Can you make available BNF description of MQL5?

If not BNF, do you have formal syntax descriptive document?

If no formal syntax description, why not?


2.

Can you make available Client Terminal Functionality Documentation?

eg, callable functions, global variable functionality, error code handling embeded within Terminal instead of current random hit and miss programmer attempts at error handling?


3.

What do you see as cut off date when MQL4 will no longer be accepted as platform?

by metaQuotes, by Brokers, ...

eg, will all MQL4 S/W become redundant unless migrate to MQL5 syntax...?


4.

Is or was there a forum thread for current users to ask, suggest, hear from developers regarding MQL5 and Client Terminal functionality features?


Thank You

 
1. You can use C++ BNF description (we cannot publish it because this form is hardcoded in our project)

The differences as compared to C++ are:

  • No class inheritance
  • No address arithmetic
  • No operators overload (it will probably be included later)
  • No 'goto' operator
  • No ternary operation expr ? op1 : op2; (it will probably be included later)

The syntax description will be embedded in MetaEditor help files.


2. No, we cannot as yet. You should consider the functionality described in MQL4. However, the functionality will be expanded considerably.

3. You should not worry about "cut-off" date for MQL4. The upward compatibility of the languages will be kept, with some rare exceptions.

4. You can use this thread for this purpose. Welcome.

 

1.
I have no problems with single trade operation thread. You stated your thoughts here (2006.10.11 11:56) 'Request to Metaquotes to find a better solution.'


2.
your ref:

(stringo 2006.10.10 13:45) 'Request to Metaquotes to find a better solution.'
quote: "There can be a quite non-complicate solution in situations like yours.
there can be a set of functions, in which the proper error handling is programmed, that are incapsulated in a template to be applied to creation of an EA in MetaEditor.
I believe this set of functions to be made soon.
"

Well, is this to be reality?


3.

my friendly but vip concerned comments on (2):

But what does give me problems is the error handling environment presented to coders.

.

Specifically:

ERR_TRADE_TIMEOUT

Timeout for the trade has been reached. Before retry (at least, in 1-minute time), it is necessary to make sure that trading operation has not really succeeded

(a new position has not been opened, or the existing order has not been modified or deleted, or the existing position has not been closed)

.

Should there not be a consistent and thoroughly documented procedure to follow for 'every' possible error?

.

Should I not know that when OrderSend() results in a timeout error that there is a guarrantee by ClienTerminal that order will be removed from brokers server?

.

Current docs state that one must 'somehow' determine if tradeOp was actually accepted by server.

.

For OrderSend() this is oxymoron - the only datum EA has is magic# which it could inspect trade pool for (say, after suitable Sleep() period)

.

See what I mean?

eg, if get timeout on order[delete,close,modify] it is possible to enter retry loop and alternately sleep and then inspect terminal pools to determine if action was really applied or not (I am assuming that it is the terminal that timesout due to no server ack - and terminal then calls EA with function fail code and lastError of timeout code, yes?) Now, during the EA recognising timeout and issuing sleep(), there is window during which [am guessing here] that server 'finally' sends ack to terminal and terminal updates it's database for this tradeOp. This leads us to EA waking up and now inspecting trade pool and hey presto! learns that tradeOp OK [or !ok], yes?

.

Above scenario is messy but will work(*) but not for OrderSend(). Why? because only magic# and yes, is possible to say let's retry loop for x times but what happens IF magic# never found in pool?
(*) again, I say is possible because is data EA can check in pool BUT timeout error is not EA error: is timing/comms error and why should EA be given the onerous task of attempting to 'discover' is tradeOp ok/!ok, with retry loops having messy cumbersome checking code etc. This is surely, ClientTerminal TradeServer issue and not functionally part of trading paradigm.

.

Where is warranty that broker 'did not' open order?

.

EA may not have long enough sleep in retry loop... so total retry loop time could be less than time needed for broker to ack back to terminal, yes?
If timeout can happen then any scenario one cares to dream up is possible, yes?

.

I believe this to be circular problem without any answer.

.

Unless terminal can warrant that orderSend (and actually - all other tradeOps too!) was removed/notApplied by server there is no way for EA to 'know' is there?

.

Is bad enough if orderModify, because how else can EA know if success unless enter retry loop and in the inspect section, compare pools data with the actuals used in orderModify call - if same... then server must have finally sent ack to terminal and terminal must have updated order data, yes?

.

So is possible but for all but orderSend - as I understand it.

.

Regardless of this 'possiblilty' it is imho, irresponsible of terminal to not have clean bullet proof way of error handling for ALL errors. Of course tradeOp errors are by far the greatest worry for trader, yes? Surely must be total binary process: YES or NO

.

I do not care if EA does anything as long as it does not wipe out my deposit! (due to its inability to KNOW yes||no regards tradeOps)

.

Currently, my only EA errorHandler() coding response to above is to cause EA to abort - until manual intervention arrives on scene.

.

Surely it is only [reasonably] simple interface implementation to cause trade server to effectively "backout" of a dubious tradeOp when timeout error has manifested. Is like database updates, yes? Either total update applied OR 'backout' happens and client s/w is so informed...
Straight cut - no grey areas = simple!


4.

Of course - what I derperately require right now is a "method to follow" when OrderSend() results in ERR_TRADE_TIMEOUT

and other tradeOps getting too... ))


I thank you for time taken to read and [hopefully - fully] respond to my very real concerns which are causing me currently constant sleepless nights...


Regards

 

structs will be very nice to have, i have too many arrays already :)


how about javascript like associative arrays (like obj["X"] = x; obj["Y"]=y; and so on?)


that a multithreaded tester is all im asking for.


Keep it up..

 

What is the syntax's difference between MQL4 and MQL5?

Maybe you can share a moving average EA in MQL5 to give us a brief sight?


Thanks

 
devilian1899:

What is the syntax's difference between MQL4 and MQL5?

Maybe you can share a moving average EA in MQL5 to give us a brief sight?


Thanks

It may be difference between OrderSend(MQL4) and OrderSend(MQL5) function calls. But this is no matter of MQL5 syntax - it is just feature of MT5 trading platform
 

So MT4's EA will need some modifications to be able to run on MT5? When will it approximately released?


Thank you

 
Can you please include one very simple but also very useful feature in future versions of client terminal.

Right click on chart --> Duplicate chart.


It would be very useful to have a quick way to copy charts.



It would also be very helpful to have the option to change the currency pair with right click on the chart just like you have it now for changing the timeframe.. (menu with all the pairs opens there.) (or maybe not *all* the pairs. could aslo be user defined pairs.)



Oh, yes, and one more feature!


Please make some key combinations for changing the template on the chart. Just like you have Ctrl-F5 and Shift-F5 now for changing the profile.

 

Hi,


Will MQL5 be multithread to take all quad-core processors capacity on Tester?

Thanks,

 
Tester is planned to be multithread. But this is client terminal feature not MQL5
Reason: