The problem of transferring from MT4 to MT5. Or, more precisely, the inability to execute some algorithms in MT5 without'err. - page 3

 
Eugeni Neumoin:

I have tried to answer the question. The data is not available.

The log is in the tooltip. The code for the tooltip is given. The timeseries has been generated. A graph with W1 timeseries is built. Dostap is absent. The iBarShift function generates an error. The same error is not seen in MT4.

Once again you ignore the request to show the code and the result of work.

Please provide a reproducible MQL5 code.

 
Eugeni Neumoin:

Artem, were you the one who deleted my post in the article discussion thread. Where did I respond to a forum member's request?

I was just touching on the topic raised in this forum thread. And I was angered by this cavalier attitude. So I created this forum thread.

======

I've had disagreements on this forum before. You don't want to discuss here. There are many forums where you can say a great deal without censorship.

Back in 2005 a moderator (HQ) did something similar on the Alpari forum. And then almost the whole forum moved from Alpari to Onyx.

No, I didn't delete anything

 
Vladimir Karputov:

Once again you ignore the request to show the code and the result of the work.

Please provide reproducible MQL5 code.

The thing is that the code has about 50 000 lines. I will not post it publicly.

The situation is floating. But... I will try to create another code. It won't be small either.

And it will take time.

I hope you've read my links in the Language Guide I'm referring to. It says in black and white by someone at Metakvotes that data access can be terminated at any time.

Here's the full quote from the language handbook:

Data Availability.

The availability of data in HCC format or even in ready-to-use HC format does not always mean that this data is unconditionally available for display on a chart or for use in mql5 programs.

When accessing the price data or indicator values from mql5-programs, we should remember that it is not guaranteed to be available at a certain moment of time, or from a certain point in time. This has to do with the fact that MetaTrader 5 does not store the full copy of the required data for mql5-program, but gives direct access to the terminal database in order to save resources.

The price history for all timeframes is built from the common data in HCC format and any update of the server leads to the data update for all timeframes and indicator recalculation. Therefore,the access to the data may be denied even if this data was available just a moment ago.

You can also do it in a simpler way. I have already had several people buy this program. If I get any complaints from them about this thread, I will publish their messages here. And let everyone know that this is stipulated by the developers of the language:access to data may be denied even if this data was available a moment ago.

 
Eugeni Neumoin:


Provide the terminal settings together with the code: number of bars on the chart.

 
Vladimir Karputov:

Provide the terminal settings along with the code: number of bars on the chart.

The number of bars is the default. Somewhere around 100,000. And access is denied in the examples above to 271 bars.

 
Eugeni Neumoin:

The number of bars is by default. Somewhere around 100,000. And access is denied in the examples above to 271 bars.

When working already on H1 this is a negligible number of bars.

So: reproducible code, terminal settings(number of bars on the chart).


Without this minimum there is simply nothing to discuss - as so far it is air.

 
Eugeni Neumoin:

The number of bars is by default. Somewhere around 100,000. And access is denied in the examples above to 271 bars.

Every two minutes we need to get data from all used timeframes and symbols in the indicator.

In the handler OnTimer(), in other words - in the timer, apply once every 90 seconds to all timeframes, that are necessary for the work of the indicator. You can use any Copy function. Just get the data "in the middle of nowhere", for example from the first or current bar for each used timeframe. This will be enough to maintain all data for all timeframes up to date.

And at the very beginning of OnCalculate() check what the function that accesses the data of the desired timeframes returns. If it returns -1, then exit before the next tick.

 
Artyom Trishkin:

Every two minutes you should receive data from all used timeframes and symbols in the indicator.

In the handler OnTimer(), in other words - in the timer, every 90 seconds or so address all timeframes, that are necessary for the work of the indicator. You can use any Copy function. Just get "nowhere" data, for example from the first or current bar for each of the used timeframes. This will be enough to maintain all data for all timeframes up to date.

And at the very beginning of OnCalculate() check what is returned by the function, which accesses the data of desired timeframes. If -1, then exit before the next tick.

No problem with OnCalculate(). The entire GUI works through OnChartEvent() . There are more than 400 buttons in the GUI. Some of the buttons do not interact with the timeseries in any way. Functions OnCalculate() and OnTrade() can wait until the next tick. This is not psychologically noticeable. And it is more complicated with OnChartEvent(). Here human psychology is involved. The program user presses the GUI button. And he/she doesn't get the response he/she wants. What is his/her reaction? One of the reactions is that he/she presses the same button a second time. I have made it so that a second press on many of the buttons disables the functionality connected by that button. I anticipate your suggestion to make the button action disable in some other way. But there is the same program for MT4. It works there normally. It will turn out that MT4 has one algorithm of interaction with the graphical interface, while MT5 has a different one. Such behavior of the same program will only cause rejection.

I did something similar when translating to MT5 - I enabled exit from OnChartEvent(). I don't want to lie, that's why GUI was just dying.

And in my case the reference to timeseries in OnTimer() occurs after 5 minutes. I'll do it after 2 minutes. I'll check what will happen.

Artem, your suggestions were useful before too.

 
Vladimir Karputov:

When working already on H1 it is a negligible number of bars.

So: reproducible code, terminal settings(number of bars on the chart).


Without this minimum there is simply nothing to discuss - as so far it is air.

Please do not interfere further with the problems I raise on the forum.

Communication with you has not been anything useful before or now.

You can write something in other branches of the forum. And in my branches please do not participate.

 
Artyom Trishkin:

I have made all the timeframes to be accessed every two minutes. Checking access to timeframes inOnCalculate() does not seem to cause difficulties in program operation.

But checking inOnChartEvent() affects the operation. In some cases the GUI refuses to work.

I will observe how the program works when all the tf's are accessed once every two minutes.

================

By the way, I have found one more difference between MT5 and MT4.

The binding of graphical tools via graphical interface is performed to numbers of zagzags extremums or symbols of wave markup.

Binding is performed when the program "sees" a number or a symbol. Let me explain what is meant by that. When you hover over a number or symbol, a tooltip appears.

If the tooltip appears, then the program "sees" the number or symbol. If there is no tooltip, the number or symbol remains invisible. The graphical tool is not attached. Consequently, the graphical tool is not shown on the chart.

If, for example, Andrews' Pitchfork is already bound to this number or symbol (I did not check it with other graphical tools), the tooltip appears in MT4. But the tooltip appears very seldom in MT5. But if I hide the Andrews' Pitchfork linked to the given number, the tooltip will be displayed normally.

I have a feeling that if there are some other graphical objects near the number, MT5 will be less sensitive when displaying the tooltip. But I do not exclude that it happens because MT5 has to make some additional time-series updates that are not available in MT4. These extra updates may be causing a delay in some MT5 functions. (This is my fantasy. I don't know the inner workings of MT5).

Использование аналитических объектов - Графики котировок, технический и фундаментальный анализ - MetaTrader 5
Использование аналитических объектов - Графики котировок, технический и фундаментальный анализ - MetaTrader 5
  • www.metatrader5.com
Определение трендов, построение каналов, выявление циклов и уровней поддержки/сопротивления — все эти и многие другие задачи решаются при помощи аналитических объектов. Всего в торговой платформе доступно 46 таких инструментов. Среди них имеются геометрические фигуры, различные каналы, инструменты Ганна, Фибоначчи, Эллиотта и многое другое. В...
Reason: