Beta Testing of MetaTrader 5 Has Started! - page 18

Andriy Moraru
Andriy Moraru  
I've got a problem with accessing the deals and orders from MQL code of the expert advisor. I've tried using HistoryDealsTotal(), HistoryOrdersTotal(), HistoryOrderGetTicket(), HistoryDealGetTicket(), OrdersTotal(), but I didn't get any results (all functions return 0) despite the good amount of deals closed and opened by the EA. Is everything OK with these functions?

Can someone tell me if MQ5 has the same lame label length limitation?

And order comment length as well? Now that apparently there's no more magic numbers, it would be impossible for me to port without reduced functionality.

Why can't MetaTrader allow multiple comments to be attached to a single order and allow comments to be added to open orders at any time?


May be. But I don't know what is "snapping feature". Sorry...

This is not so arguable but anyway...

In computer graphics, snapping allows an object to be easily positioned in alignment with grid lines, guide lines or another object, by causing it to automatically jump to an exact position when the user drags it to the proximity of the desired location.

Current Magnet sensitivity feature snaps trendlines to bars (but not to objects! often i need to snap a trenline to the midpoint of the other one. i zoom out the chart and do it by hand) only in start and end points of the trendlines. It would be good to have such snapping feature for any objects (not default but via checking). From any segment to any segment.

For usability.

I just write my wishes... :-)


It is interesting that we can receive by using a script and ofline, data with any period i.e. charts M7, M19 etc but Metaquotes cannot do it automatically.

Relative to the Startegy Tester. I would like to have the posibility to see results of calculations even if there is no win by using a specific strategy. This is very helpful.

The method of scanning all parameters is one way to find optimum values of parameters but even before second world war other methods have been found and can give faster the results.




This is a MT4 script to rewrite from mq4 to mq5.

-mq4 file ---> MT4/exterts/files folder

-run this script (input file name mq4 & mq5)

extern ---> input

Account function rewrite

String function rewrite

Add any code the top of init,start and deinit


-I changed the function in ver2

-ver3(rewrite [init,deinit,start])

mq4 file --->MT4/extperts/files

run this script(input mq4 file name,and select file type)

-ver4(Insert include, fixed end of return() in OnCalculate)

we can use some helpfull includes thanks to circlesquares!

stringo wrote >>

There was problem to separate DDE flows from different MT4 terminals, they all were signed as "MT". Solution was implemented as DLL attached to EA. Try to find it

Has anyone found any documetation anywhere on how to utilize the mql5.dll file?


Important question, when you place a bitmap on the back of other objects, is it supposed to not be able to interect with the objects on the front?

The idea is to try to build some general class for building UI, by applying parent and child objects, like windows programming in case anyone ever used it.


I use this code in MT5 to count number of open positions with filters for symbol and position open Expert ID (MagicNumber). The code _OrdersTotal() returns 0 when there is an open position as confirmed with the added Comment() line. Is the problem my MT5 coding or with MT5 language?

int _OrdersTotal() { 
   int _total=0; 
   for (int i=0; i<PositionsTotal(); i++) { 
     if(ExtOI.Expert()==MagicNumber )  

I took the MT5 MACD EA sample and attached is the complete code.

I added the following:

1) #include file (OrderInfo.mqh)

2) input ulong MagicNumber

3) MagicNumber to both buy and sell PositionOpen calls

4) Comment() line to confirm open positions.

Al W
Al W  

Not sure if I found a bug or if its by design, but after a minute of local time, the bar data from a tf that is not loaded on a chart seems to be cleared.

so if i'm on H4 and I call on my new iHigh function like:

Print(iHigh(NULL,PERIOD_H3,11));//we are asking for the high of the 12th bar on H3

that will on first call fail. but then if I call it again in under a minute, it will work. If we wait a minute further, it will fail. So their seems to be some clearing of the bar data on a consistent basis, and it doesn't get recreated until we force it by calling on it. problem is, it isn't recreating the data until AFTER my function is returned. Hope that explains it clearly.

So is this a bug or is their a workaround that we should be using?

I found the workaround to this(it involves looking at SeriesInfoInteger(symbol,tf,BARS_SYNCRONIZED) in a loop with a Sleep until it returns true) and also made major changes to the timeseries and made it much much faster. Will post later.

Does anyone have a feeling for what area of code creates a "code generate error" in the compiler? I've written an include which compiles fine with a simple test EA, but won't compile when added to something more complex.