Questions from Beginners MQL5 MT5 MetaTrader 5 - page 189
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
How is Metatrader 5 different from the previous 4 is harder to work with or not. Every broker offers these programs, why isn't there one program for all brokers so you don't have to install a lot of them.
I'm trying to make a function that will return the result of the last position closed (plus or minus). This function is designed for a multicurrency Expert Advisor and should select the last closed position out of all currency pairs, and I'm having some problems with it. Can you correct the function?
OBJ_ALL_PERIODS=2097151
What do you mean: unused methods in your classes? This is not the practice in OOP. A normal OOP programmer, in contrast to algorithmic programming, creates classes with all the necessary fields and methods, as they say, for all occasions, because the same class may be later used in other applications or become a part of class library. Not to mention the fact that even within one project it is better to create full classes, not stripped-down, so that you don't have to search through the source code and add the required fields and methods later.
In OOP any economy, which many people get used to in algorithmic programming, may turn out to be detrimental later. Everything what is not used must be excluded from the code by the compiler and not by the programmer.
Of course, OOP results in a larger source code compared to algorithmic programming. But this is not a drawback but an advantage because much of the "unnecessary" code in a given project can be reused in other projects.
There is no need to try to make a conundrum, i.e. everything in one class. You need to create class libraries, i.e. break functionality into separate classes and don't forget to add comments to this fiefdom, and then everything will be in order. Initially, when I started learning Java after Pascal, I too tried to do everything in one piece, i.e. instead of using OOP, I created one class with everything I needed for a certain task, just like in algorithmic programming. The result was a non-universal mess that was impossible to apply anywhere later, not to mention that it was hard to understand such code.I understand all that very well. But you can at least show us private variables that are not used as it is done in VisualStudio, can't you?
The point is that classes are designed during the development process. You simply cannot take into account everything before creation. That's why frame classes with the least possible functionality are created. While interacting with these framework classes, the overall architecture starts to be elaborated. Some methods are simply deleted, others are moved to the private section, and others are migrated from one class to another. In the process, forgotten variables, methods and even entire classes inevitably appear. This is normal because it's something else like the Okama principle in action - first we write bad, redundant code. Then we formalize the task more clearly and some of the entities simply disappear. Redundancy comes to naught. And it is in this process, the compiler's help would be very useful - to see unused variables and at least private methods would be very useful.
Hello.
I understand that the functionOnCalculate() that is used in the indicators generates by itself, i.e. without the price change event ,
What function can be applied in the indicator that generates only when a price change event occurs? Thank you
Hello.
I understand that the functionOnCalculate() that is used in the indicators generates by itself, i.e. without the price change event ,
What function can be applied in the indicator that generates only when a price change event occurs? Thank you
TheCalculateevent is generated for indicators immediately after the Init event and at any change of price data. It is handled by theOnCalculate function. When history is changed (when history is paging) this event will also generateOnCalculate.
TheOnCalculate is the most important function for the indicator, in which all of the indicator calculations are performed in case of price data changes.
TheCalculateevent is generated only for indicators immediately after the Init event is sent and upon any change in price data. This event is handled by theOnCalculate function. The sameOnCalculate is generated when history is changed (when the history is paging).
TheOnCalculate is the most important function for the indicator, in which all of the indicator's calculations are performed in case of price data changes.
Here it has some looping, i.e. it always generates and when the period changes, the readings change. What is the error?
#property copyright "Copyright 2014, MetaQuotes Software Corp.ArraySetAsSeries(high_nachalo,true);
shift_nachalo=ArrayMaximum(high_nachalo,barUP-1,barDown-(barUP-1));This is where the loop happens, i.e. it constantly generates and when the period changes, the readings change. What is the error?
How to insert the code correctly in the forum.
Note the error:
Use: