Errors, bugs, questions - page 3125
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
God, these buffer indicators are so uncomfortable. Creepy.
With canvas drawing everything is much easier, less code, clearer, more versatile and complete freedom of action.
Everyone understands your fondness for kanvas long time ago. But not everyone is so used to it... )))
You shouldn't.
Yeah... if I don't die first...
Probably not a crutch, but so far I have no explanation for what's going on. Thanks...
Probably depends on which buffer is higher in the build. Just change the + to -
and it'll work too. But I needed to direct the thickness inside the bar.
Filling buffer has two colours. You have to set them both separated by commas. Which one is higher on the screen determines the fill colour. You don't specify one of the colours - it's replaced by clrNONE
It is easier to work with buffers, but you can output anything on Kanvas. On the other hand, in the custom indicators in MQL5 there are also a lot of different types of indicator buffers. In general, the programmer should not make a mistake by choosing any of these methods. But the choice should always depend on the task at hand...
Of course, buffers are more difficult to work with. It's easier with a canvas.
You can't put #property into a function.
And you can add a kanvas line with a single line by passing an array to a function.
Personally I use kanvas more for visualization of some processes and intermediate data during development. This way it's easier to see problems and find optimal solutions.
Unless, of course, we're talking about primitive algorithms built on intersections.
Here is, for example, my current work.
All this veneer is service and it helps me a lot to find optimal solutions.
With buffers, of course, it can't be done. Moreover, this solution works equally in Expert Advisors and indicators. And the code works in MT4 as well.
Of course, buffers are more difficult to work with. It's easier with a canvas.
You can't put #property into a function.
And you can add a kanvas line with a single line by passing an array to a function.
And this is implemented very easily and quickly. Literally on the fly.Personally I use kanvas more for visualization of some processes and intermediate data during development. This way it's easier to see problems and find optimal solutions.
Unless, of course, we're talking about primitive algorithms built on intersections.
Here is, for example, my current work.
All this veneer is service and it helps me a lot to find optimal solutions.
With buffers, of course, it can't be done. Moreover, this solution works equally in Expert Advisors and indicators. And the code works in MT4 as well.
This problem requires the use of Canvas. Of course, we have no other choice. Although there is one possibility, it is DirectX. But I don't know who uses it in MQL applications. I've never seen such examples. Kanvass helped me a lot when I needed to output the oscillator in chart together with trend indicators. Of course, I cannot achieve such a result using custom indicator mechanisms. I created two classes based on CCanvas. One of them displays oscillators, the second one - trend indicators using methods, where arrays of indicator values, arrays of colours and arrays of colour indexes are passed. But when I need to display one indicator, I use methods of custom indicators. I do not know why. Either it's a habit or I don't want to complicate the code too much, when the main point and complexity is in the calculation of values, not in the method of their output.
But the choice should always depend on the task at hand...
I forgot to tell you. Using Kanvas is also very useful in robots, where you need to output calculated values in a chart, but indicator buffers are not available. Then the values or signals can only be output using Kanvas if there are enough of them (not 2-3 signals that can be output using graphical objects).
God, these buffer indicators are so uncomfortable. Creepy.
With canvas drawing everything is much easier, there is less code, clearer, more universal and complete freedom of action.
The versatility of a canvas ends when its values need to be obtained from another EA/indicator.
Or have you already found a solution for that too? )
The versatility of Kanvas ends when its values need to come from another EA/indicator.
Or have you already found a solution to that too? )
What are the problems, Andrei?
You form a data structure or an array of structures in the EA or in the indicator and send it to a resource.
And on the receiving side, you read this structure or array of structures.
It's even more convenient, because you have to deal with names and different types of data of needed sizes, rather than numbered double arrays of the whole length of quotes.
If this is an indicator for a market, but you have to provide the class that reads data from the resource.
The client only needs to add an include and declare an instance of the class. Maybe also call methods from OnTimer and OnTick. And then this instance of the class will always have actual data of the read indicator in the form of a conveniently readable structure or array of structures.