I try to draw a horizontal line, when a button is pressed.
In addition, when the same button is pressed for a second time, I like to remove the horizontal line. So on so forth.
The problem is that if I insert code related to drawing objects inside the inner if conditional block, the behavior of the OnChartEvent() becomes totally unstable.
Just add the highlighted part to further filter the chart events:
if (btn_test1.Pressed() && id==CHARTEVENT_MOUSE_MOVE)
Libraries can make programming easier, but it seems to make it more complicated.
I don't know what's going on.
Instead, I extracted the functions of the panel display from the ranking board which I use and created a new program as follows.
This is a "indicator", not "EA".
I plan to make trade orders in this code, so I suppose I need an EA.
But I would like to thank for your attention.
- www.mql5.com
Just add the highlighted part to further filter the chart events:
Thank you very much.
It works.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I try to draw a horizontal line, when a button is pressed.
In addition, when the same button is pressed for a second time, I like to remove the horizontal line. So on so forth.
The problem is that if I insert code related to drawing objects inside the inner if conditional block, the behavior of the OnChartEvent() becomes totally unstable.
I added Print() lines in order to debug it where Print() functions executed several times and sometimes the line is not deleted.
I could not figured out, what is going on.
Please while testing also try to comment out the ObjectDelete() function, and vice versa.
Click at least 10 times to the button, then check the Experts tab for printed lines.
Thank you.