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
Hello!
I need to see graphically how the value of a certain variable changes on each bar during a visual test, i.e. I need to build a separate graph in a sub-window. For example, I want to see a graph of equity changes on each bar in a separate window below the chart.
What should I do? Should I write an indicator, attach it to the chart and pass to it the values of variables from the EA through global variables of the terminal? Or there is a "better" way?
Thank you in advance.
Hello!
I need to see graphically how the value of a certain variable changes on each bar during a visual test, i.e. I need to build a separate graph in a sub-window. For example, I want to see a graph of equity changes on each bar in a separate window below the chart.
What should I do? Should I write an indicator, attach it to the chart and pass to it the values of variables from the EA through global variables of the terminal? Or there is a "better" way?
Thank you in advance.
Not at all, you can get equity or balance values directly in the indicator.
Define the parameters of the indicator buffer drawing as a bar chart.
And write all four values in the appropriate buffers,
Open at bar opening, high-low and dynamic (the last bar).
In short, it looks like this: in the attachment
Of course, you can use absolute value (recommended option), but I don't think it shows small initial increments, so I think the difference between initial and current values is better.
ZS, but no, the scale is dynamic so you can do the second option, it's quite readable.
Not at all, you can get the equity or balance values directly in the indicator.
Set the parameters for drawing the indicator buffer as a bar chart.
and write all four values to the corresponding buffers,
open at bar open, high low and close dynamically (last bar).
OBJ_LABEL on the chart.
You can also read it here:
https://www.mql5.com/ru/forum/1111/40260#comment_40260
https://www.mql5.com/ru/forum/2963
Equity and balance values - yes, but what if I want to see the value of a variable calculated in an EA?
You can do it via custom event, just don't forget to update the chart after the event,
because the tick comes before the event is processed, in order of priority.
But it is possible to do it with globals, but there is the same problem - the tick has already come and the variable is still being processed in the EA (its changes are being prepared), of course, the data will be received, but there will be a delay on one tick, it is still more correct in the event, there is a place to put update the chart after the fact, when you already know for sure that the variable has the actual data.
This code does not compile with the error "'return' - structure has objects and cannot be copied" because of the"CTest getCopy(void) {CTest res; return res;}" stop.
This can be fixed in 2 ways:
1) change"class" to"struct"
2) uncomment the stopka with an overloaded assignment operator.
So it should be so that the role of copy constructor is performed by overloaded assignment operator? Why then it is not mentioned in the reference book, except for one example of a matrix class (detailed analysis of which, by the way, allowed me to find the error in my code)?
This code does not compile with the error "'return' - structure has objects and cannot be copied" because of the"CTest getCopy(void) {CTest res; return res;}" stop.
This can be fixed in 2 ways:
1) change"class" to"struct"
See above.
2) uncomment the stopka with an overloaded assignment operator.
Of course, the overloaded operator returns a handle-pointer, which is normal. Now it's not the object returned from the getCopy() function but the pointer (the return from the function is an implicit assignment) which makes the code correct.
// Only syntactically correct.
// Return of an uninitialized variable from the getCopy() function, I hope, serves only to demonstrate the syntax problem and does not pretend to be reasonable.
So it should be so that the role of copy constructor is performed by overloaded assignment operator?
Why is it not mentioned in the reference book, except for one example of a matrix class (its detailed analysis, by the way, helped me find the error in my code)?
Because on February 11, 2096785 BC, dinosaur Vasya carelessly stepped on the lizard Clava. It caused a long chain of causes and consequences, which led to the current situation. You can't help it.
;)
Why should it be initialised? It's an instance of a class that has a constructor for just that purpose.
Um... What do roles have to do with it? You may overload the assignment operator in any way you want and write the copy constructor correctly. Your error is in another place entirely.
And then how to write a correct copying constructor for this purpose?