
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
Here I have a practical question.
Why is it necessary to check the indicator handle for disability at each call of CopyBuffer()? In my EA I made this procedure once (with the arrival of the first tick, after checking the data synchronisation), and later I started to receive error 4807 Error indicator handle. CSymTotal=7. Handles were received in an array:
Print check shows that all seven H_Ind[0..6] have values 10..15 respectively, i.e. different from -1. The handles seem to be valid, but in response to CopyBuffer(H_Ind[0-6]...) I get CopyBuffer=-1, LastError=4807(!!!).Sometimes it goes normally, and sometimes it gets errors.After I introduced checks like in this article,
so far everything is working properly. Mystery...
I don't understand what my fault is.... And most importantly, why is it necessary to check the handle for validityevery time I use CopyBuffer() and create it again? Isn't it saved until the Expert Advisor finishes its work? Is it a necessity in general, or is it just for the convenience of the example?
Here I have a practical question.
Why is it necessary to check the indicator handle for disability at each call of CopyBuffer()? In my EA I made this procedure once (with the arrival of the first tick, after checking the data synchronisation), and later I started to receive error 4807 Error indicator handle. CSymTotal=7. Handles were received in an array:
Print check shows that all seven H_Ind[0..6] have values 10..15 respectively, i.e. different from -1. The handles seem to be valid, but in response to CopyBuffer(H_Ind[0-6]...) I get CopyBuffer=-1, LastError=4807(!!!).Sometimes it goes normally, and sometimes it gets errors.After I introduced checks like in this article,
so far everything is working properly. Mystery...
I don't understand what my fault is.... And most importantly, why is it necessary to check the handle for validityevery time I use CopyBuffer() and create it again? Isn't it saved until the Expert Advisor finishes its work? Is it a necessity at all, or is it just for the convenience of the example?
In general, the question should be formulated more broadly:
What checks, conditions, or delays should be introduced BEFORE and AFTER CopyBuffer(), in order to GUARANTEEDLY get those 400(0) indicator values, which I need now(!), on seven (ten) instruments in maximum speed conditions (in a loop)?
For, return(0) = "ah, well, it didn't work now, maybe next time it will work...".
Here, by the way, the rest of Copy is next to it...
PS. Perhaps it's already off-topic. Well, the question is not for the author, but for everyone who can clarify...
In my examples the condition looks like this: if the handle is valid, we proceed to copying data. if not, we create the indicator again and exit this function, as the calculation of the indicator takes time. the same happens with copying, during copying the indicator can be recalculated, so CopyBuffer() returns -1, as soon as the data is ready the function will do its work, that's why it is necessary to check it all.
Yes, Sergey, I understand. I didn't mean to cast any shade on the article or the author. The article is excellent. This is not a complaint, but an attempt to find an answer. It's just the closest discussion I've found on the subject. You'd probably like to know the answer more accurately, too, wouldn't you? )
Maybe we should put it in a separate thread?
Maybe put it in a separate thread?
https://www.mql5.com/ru/forum/1880.
Here, put it in the topic. Sergey, I apologise for going beyond the scope of the article. I will be glad...)))
wish someone can give 20 methods for Money Management !!!!!!
For this article, the idea is very good. But you have forgotten the concept of OOP and programming in general: ABSTRACTNESS. Inside your functions are hard-coded inicators, current symbol, current period, indicator parameters. The idea is good, but it is not fully implemented, it is far from perfection. For example - I want to check the crossing of indicator lines, each of them from a different timeframe and from different symbols - that's one. Second - what happens to your functions if the terminal temporarily lost connection with the server and missed the very three bars that you are processing? There is a signal - but the input is missed. The search for a signal should be carried out with a CHARGE. Then the signal should be checked if it has already been processed. You may have so many intersections that you will be surprised yourself. It is enough to pass parameters (indicator number, symbol, timeframe, start of search, end of search, indicator line...) to the functions. - and you will make your system more flexible and the Expert Advisor will be able to see what is inaccessible to humans - the intersection of lines of different symbols and different timeframes. This is much better than the functions given here. You also need to work out the concept of naming variables - you have too few variables with names that don't mean anything - but this is a separate topic. This is called programming style. Everyone has his own style. But I see that you are slowly getting closer to the concepts that I tried to use in MT4 - that's very encouraging.
For this article, the idea is very good. But you have forgotten the concept of OOP and programming in general: ABSTRACTNESS. Inside your functions are hard-coded inicators, current symbol, current period, indicator parameters. The idea is good, but it is not fully implemented, it is far from perfection. For example - I want to check the crossing of indicator lines, each of them from a different timeframe and from different symbols - that's one. Second - what happens to your functions if the terminal temporarily lost connection with the server and missed the very three bars that you are processing? There is a signal - but the input is missed. The search for a signal should be carried out with a CHARGE. Then the signal should be checked if it has already been processed. You may have so many intersections that you will be surprised yourself. It is enough to pass parameters (indicator number, symbol, timeframe, start of search, end of search, indicator line...) to the functions. - and you will make your system more flexible and the Expert Advisor will be able to see what is inaccessible to humans - the intersection of lines of different symbols and different timeframes. This is much better than the functions given here. You also need to work out the concept of naming variables - you have too few variables with names that don't mean anything - but this is a separate topic. This is called programming style. Everyone has his own style. But I see that they are slowly getting closer to the concepts that I tried to use in MT4 - this is very encouraging.