Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
I do all drawing, tied to bars or time, in one function, for example void Draw()
I add a line to OnChartEvent to track the chart change event (a new bar is also a chart change event).
In OnCalculate for the test mode I add a line for redrawing, for example, when a new bar occurs, because OnChartEvent does not work:
If it doesn't work in MT4, then something is wrong with the CHARTEVENT_CHART_CHANGE event. I can't check it now, there are no quotes yet.
Nicholas, so that you don't waste your time, I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Nicholas, so that you don't waste your time I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
In normal non-test mode you should not do this, because the ChartChanged() function will be executed twice in a row, which is not reasonable. After all, it is executed when the CHARTEVENT_CHART_CHANGE event occurs inside the iCanvas.mqh file. It is correct to redraw your canvas bound to bars or time in OnChartEvent when the window change event ( CHARTEVENT_CHART_CHANGE) occurs without using ChartChanged().
Nicholas, so that you don't waste your time, I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
You need to take the following into consideration:
ChartChanged() is executed each time the CHARTEVENT_CHART_CHANGE event occurs in OnChartEvent inside the iCanvas class
The OnChartEvent inside the iCanvas class is executed first , and then the OnChartEvent of your code is executed .
Your problem was because OnCalculate is apparently executed before OnChartEvent is executed and therefore ChartChanged() has not been executed yet. That's why it is reasonable to implement the redraw handler exactly in OnChartEvent and not in On Calculate. Especially it should be done because the user can change the size of the window at any time. The CHARTEVENT_CHART_CHANGE event is responsible for all this
I didn't get it, do you need to move the rectangular area inside the whole canvas?
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply an x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Yes, it's a reasonable wish. All the more it is not difficult to implement it. I thought about it, but I came to the conclusion that if there is a need to move the rectangular part of the common canvas, there is an easier way to implement it:
Create a new smaller canvas. In this case, you don't have to worry about filling the background of the part to be moved.
Yes, a well-founded desire.
Moreover, it is not difficult to implement it.
I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the common canvas, then there is an easier way to implement it:
Create a new, smaller canvas. In this case, you don't have to worry about filling the background of the moving part.
Yes, quite a reasonable desire. All the more it is not difficult to implement it. I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the general canvas, there is an easier way to implement it:
Create a new smaller canvas. In this case, you don't have to worry about filling the background of the part to be moved.
Yes, a well-founded desire.
Moreover, it is not difficult to implement it.
I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the common canvas, then there is an easier way to implement it:
Create a new, smaller canvas. In this case, you don't have to worry about filling the background of the moving part.
That's not working because my Canvas is the fullscreen. It's like a tick chart but it cost too much time to erase the complete background and construcht and paint everything new so I need to move the content to the left (eg. 8 pixels) and draw only the new 8 pixels (8 px in x direction and full height) with new data. I tried to move the Canvas 8 px to the left with MoveCanvas and this is working but I can't resize it the way that from the left 8 px width are removed and on the right 8 px are added. I hope you understand...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Does this apply to the normal mode or the tester?
Normal mode, Nikolai.
Thank you!
Is this function not suitable?
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
Normal mode, Nikolai.
I usually follow the following scheme:
.
If it doesn't work in MT4, then something is wrong with the CHARTEVENT_CHART_CHANGE event. I can't check it now, there are no quotes yet.
I usually do the following:
If it doesn't work in MT4, then something is wrong with the CHARTEVENT_CHART_CHANGE event. I can't check it now, there are no quotes yet.
Nicholas, so that you don't waste your time, I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Nicholas, so that you don't waste your time I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
In normal non-test mode you should not do this, because the ChartChanged() function will be executed twice in a row, which is not reasonable. After all, it is executed when the CHARTEVENT_CHART_CHANGE event occurs inside the iCanvas.mqh file.
It is correct to redraw your canvas bound to bars or time in OnChartEvent when the window change event ( CHARTEVENT_CHART_CHANGE) occurs without using ChartChanged().
Nicholas, so that you don't waste your time, I wrote above a solution that solved my problem, namely, as you correctly noticed, the following code inserted into OnCalcucate():
You need to take the following into consideration:
Your problem was because OnCalculate is apparently executed before OnChartEvent is executed and therefore ChartChanged() has not been executed yet.
That's why it is reasonable to implement the redraw handler exactly in OnChartEvent and not in On Calculate. Especially it should be done because the user can change the size of the window at any time. The CHARTEVENT_CHART_CHANGE event is responsible for all this
I didn't get it, do you need to move the rectangular area inside the whole canvas?
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply an x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply an x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Yes, it's a reasonable wish.
All the more it is not difficult to implement it.
I thought about it, but I came to the conclusion that if there is a need to move the rectangular part of the common canvas, there is an easier way to implement it:
Yes, quite a reasonable desire.
All the more it is not difficult to implement it.
I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the general canvas, there is an easier way to implement it:
That's not working because my Canvas is the fullscreen. It's like a tick chart but it cost too much time to erase the complete background and construcht and paint everything new so I need to move the content to the left (eg. 8 pixels) and draw only the new 8 pixels (8 px in x direction and full height) with new data. I tried to move the Canvas 8 px to the left with MoveCanvas and this is working but I can't resize it the way that from the left 8 px width are removed and on the right 8 px are added. I hope you understand...