Errors, bugs, questions - page 1936
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Not ready to show the code yet due to
But ready to show profiling results from MT5 - as I understand trading functions are out of the question.
Maybe I am doing something wrong?For OHLC environment I use the following functions
Unfortunately you are doing it all wrong.
Instead of writing a native and efficient MQL5 code, you use a terribly inefficient MQL4 emulator that slows down the operation dozens of times.
The bad thing is that you don't even know what you are doing, since you are asking questions about speed.the result is the following code
https://www.mql5.com/ru/code/18305
https://www.mql5.com/ru/code/18305
Thanks - I have seen this library - the description was confusing
Most of the time is spent in the initialization phase. Unless you plan to access the timeseries data multiple times - more than a few thousand times during bar formation - you should consider alternative methods.
Unfortunately, you are doing it all wrong.
Instead of writing a native and efficient MQL5 code you use a terribly inefficient MQL4 emulator, which slows down the operation dozens of times.
The bad thing is that you don't even understand what you're doing, since you're asking questions about speed.Of course, I was looking for a solution - how to replace MQL4 functions with MQL5, particularly referring to time series, and saw that this is one of the problems encountered by most people moving to MQL5.
Accordingly, I found the solution on the same website, where one of the articles recommended my method.
Personally, I don't understand the reason for excluding a good and handy function from the language.
So my question is, what's the correct way to receive information, and how can you take advantages of MQL5?
So my question to you is: how to correctly organize data receiving for feeling the advantages of MQL5?
To use the native, more productive functions of MQL5, and not to cling to the MQL4 code. Any MQL4 -> MQL5 converter/splitter has dozens of times slower performance, since it tries to emulate direct access microfunctions from MQL4 via MQL5 bulk operations. And the emulation is done completely without optimization and caching.
At the root of the use of a particular function (a bit of code, including other people's code), there should be an understanding of what exactly is being done. Otherwise you get "I just used somebody else's code and the speed went down! You cannot get a good result without understanding the tool and what you are doing with it.
In addition to "how to do it right", I should clarify that the task of "learning to program" is extremely difficult, as soon as you get above the most basic level of operating (not even understanding, namely operating) with a language. So I see no other way to learn except reading masses of articles, documentation, ready-made code in the library and mandatory practice for several years.
Use the native, more productive functions of the MQL5 language and do not cling to the MQL4 code.
At the root of the use of a particular function (a piece of code, including other people's code) should be an understanding of what is being done. Otherwise you get "I just used someone else's code, look - the speed is down! Without understanding the tool and what you are doing with it, you cannot get a good result.
In addition to "how to do it right", I should clarify that the task of "learning to program" is extremely difficult, once you get above the most basic level of operating (not even understanding, but operating) with the language. So I see no other way to learn except by reading articles, documentation, ready-made code in the library and a few years of mandatory practice.
Renat, have you looked at the code base? I've got some code with functions adapted from MQL4.
I'm asking you specifically to write how to get the right information about the environment - referring to abstract books is not productive and only strengthens my (probably wrong) idea that this is just an excuse that you can't check.
To say that I'm so dumb that I don't understand the meaning of a function, which is to copy information into an array, is to say that the documentation accompanying the programming language is low. I don't understand the benefit of this copying from one array to another and why a function that gets information from an array as needed is terrible code.
Of course, I was looking for a solution - how to replace MQL4 functions with MQL5, particularly referring to time series, and saw that this was one of the problems encountered by most people moving to MQL5.
Accordingly, I found the solution on the same website, where one of the articles recommended my method.
Personally, I don't understand the reason for excluding a good and handy function from the language.
That's why I'm asking you, what's the correct way to receive information for me to feel the advantages of MQL5?
Perhaps I've searched poorly? Here you have everything you need instead of all this code in one copy
Forum on trading, automated trading systems and strategy testing
Errors, Bugs, Questions
Aleksey Vyazmikin, 2017.07.21 01:20
Thanks - corrected it.
As a result, the code is as follows
Time in tester has increased - tired of waiting already :)
In order to use it, you just need to understand what the structure is
Maybe I wasn't looking hard enough? Here, in one copy you get everything you need instead of all this code
In order to use this, all you have to do is understand what the structure is
We get the same thing - in fact...
The variant you suggest suits ifle:
- The calculation takes place only at the opening of a bar.
- You know in advance how many bars are needed
I have loops in my code, the amount of calculation may be unknown beforehand.
And, what's the sense in copying information for, say, 300 bars each time we open it, if it would be more reasonable to simply add information about a new bar - why didn't the developer go this way?
But I'll show you the direction:
I have no desire to communicate in this way. Instead of trying to understand what's being said, to work out what's going to happen, some incredible objections are thrown out.