MQL5 language reference

 

Didn't manage to understand, how can we calculate past values of an indicator, since there is no shift parameter ? There is nothing on the Доступ к таймсериям и данным индикаторов page that is indicated by Rosh answering to MA19, that could tell how the loss of the shift parameter is compensated. The page just shows the usage of the CopyTime and . So, I started at indicator pages to see if there is one simple example with an indicator in an iteration to show last 10 values, for instance. So I stumbled upon the iCustom function, that has an example. But this example raises other questions...

The iCustom function returns now a handle, not a number. Quite similar to Windows API functions. Probably OnCalculate event is called to iterate bars, and values are extracted from the memory object created by iCustom using CopyBuffer, into the Label1Buffer. Sure, given that it is called from an indicator, PRICE_CLOSE will make sure that current iterated bar with the ones in its back are passed to the function.

But what if I want call any indicator, or a custom indicator, to get me a value applied to a point somewhere in the middle of the series? And how do we make time translation from one symbol series to other symbol series without iBarShift?

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Also, now the platform is advertised as being able to support other assets, as stocks, futures or options. Futures and stocks have been implemented as CFDs on MT4, however there is no indication that options might be available on MT5. I don't see any MODE_DELTA, MODE_GAMMA, MODE_THETA as MarketInfo params. Also, no GetOptionChain()...

 
TheEconomist:

[...] There is no indication however that options might be available on MT5. I don't see any MODE_DELTA, MODE_GAMMA, MODE_THETA as MarketInfo params. Also, no GetOptionChain()...

Nor can I see any sign of OCO orders or stop-limits.

 
jjc:

Nor can I see any sign of OCO orders or stop-limits.

Did you find any OrderSend or OrderDelete in Торговые функции ?

 
TheEconomist:

Did you find any OrderSend or OrderDelete in Торговые функции ?

Er, I don't speak or read Russian. But, no, I was wondering about the fact that I don't see any actual trading functions. I'm suspicious how ready the software behind this is. (And, even if it is nearly ready, how eager are brokers going to be to start beta-testing on it, given that they've just gone through lots of IT and marketing spend associated with the NFA regulatory changes?)

 

I don't speak russian either... I am translating it page by page with Google Translate.

Trading functions seem to have been excluded on purpose - they might still modify them. That's why the OnTrade event has no documentation either...

They must be very careful with MT5. Should become the best retail platform available if they want anybody to purchase it...

 
TheEconomist:

I don't speak russian either... I am translating it page by page with Google Translate.

I'm particularly enjoying the fact that there still seems to be no decimal data type, but there's now a float as well as a double. Should add an extra flavour to all the questions which already get asked about NormalizeDouble() etc.


Also lots of potential fun now that we seem to have pointers, with the potential to delete objects and then try using the pointer afterwards... Adds a whole new class of possible bug to MQL code.


EDIT: oh, magic. It looks like we can now have null strings as well as empty strings. Life just keeps getting better.


Trading functions seem to have been excluded on purpose - they might still modify them.

If true, they're miles away from a launch. That's obviously the bit which requires integration with the software they sell to the brokers.

 
Where did you see pointers?
 
TheEconomist:
Where did you see pointers?

Указатели объектов. Plus the mention of the "new" and "delete" operators, such as the following code sample (unless the Russian code comments are saying "the following code is not possible"):


//--- удаляем уложенную фигуру
delete m_shape;
m_shape=NULL;

//--- создаём новую фигуру
NewShape();

More fun: all internal strings are now Unicode, and the int data type has mutated into 32-bit and 64-bit signed and unsigned integers. Can you imagine how much confusion that's going to cause, given the existing problems with things like NormalizeDouble()? Still, at least we finally get a built-in ternary operator.

 

No, russian comments says what code does -> removal and creating a new object. Although delete without parenthesis looks a bit VB-ish...

The example is badly chosen, because NewShape is a simply call to the NewShape method of the CTetrisField object. If you look on the syntax of new, you see there the example:

m_shape=new CTetrisShape1;

However, I don't think these "shape" things to be pointers. Might be simple handlers or just "object typed". I call a pointer only something that is an address.

 
TheEconomist:

Although delete without parenthesis looks a bit VB-ish...

Looks like C++ from where I'm sitting...


However, I don't think these "shape" things to be pointers. Might be simple handlers or just "object typed". I call a pointer only something that is an address.

Regardless, there's still a whole new exciting class of bug if you can "delete" something like m_shape with the potential for the pointer/non-pointer to be used again later somewhere else in the code. A class of bug not possible in MQL4, and raising some rather interesting questions about the garbage collection in MQL5.

 
Then we should have the habit to initialize pointers to NULL right in declaration and resetting them to null every time we destroy them, so we could inquire If (myobject!=NULL)...
Reason: