Hi everyone, I'm new to mql5 and I'm working on an indicator that, by design, needs a dynamic amount of lines on the graph and I'm not sure if it is possible.
The mql5 manual specifies that you use
to specify how many lines you will draw, but what if the amount changes at runtime?
The indicator represents support and resistance levels. I need to draw horizontal lines for each price bounce, so at first the indicator will rapidly amass support levels. It's not rare that level count exceeds 14. As time passes, some levels will become too outdated, and will be removed. Some levels may also be consolidated if they are close to each other.
How do I do this in mql5? To be clear I'm not asking about the implementation of the indicator logic, I'm asking how do I go about drawing the results.
I have all the levels stored in a dynamic array, and it seems to be working(more or less) as intended. Each array entry is a bar, and each entry is a dynamic array that holds levels. Displaying this info with a static amount of lines is impossible. The current work-in-progress solution I use is that I plot 10 lines, and display the first 10 levels of my array. If there are less levels I zero the extra lines. Aside from not representing the full picture it also looks like garbage. Perhaps there is some mode where I can take control of drawing and decide which pixels to draw myself?
Either you use PLOTs/BUFFERs and you set a maximum value.
Or you draw them yourself with chart objects.
Or...
Not possible.
Either you use PLOTs/BUFFERs and you set a maximum value.
Or you draw them yourself with chart objects.
Or...
Can you explain where to dig for chart objects? Google gives me CChartObject, but the manual is difficult to digest without code usage examples, which I couldn't find.
https://www.mql5.com/en/docs/objects
- www.mql5.com
- 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 everyone, I'm new to mql5 and I'm working on an indicator that, by design, needs a dynamic amount of lines on the graph and I'm not sure if it is possible.
The mql5 manual specifies that you use
#property indicator_plots N
to specify how many lines you will draw, but what if the amount changes at runtime?
The indicator represents support and resistance levels. I need to draw horizontal lines for each price bounce, so at first the indicator will rapidly amass support levels. It's not rare that level count exceeds 14. As time passes, some levels will become too outdated, and will be removed. Some levels may also be consolidated if they are close to each other. How do I do this in mql5? To be clear I'm not asking about the implementation of the indicator logic, I'm asking how do I go about drawing the results.
I have all the levels stored in a dynamic array, and it seems to be working(more or less) as intended. Each array entry is a bar, and each entry is a dynamic array that holds levels. Displaying this info with a static amount of lines is impossible. The current work-in-progress solution I use is that I plot 10 lines, and display the first 10 levels of my array. If there are less levels I zero the extra lines. Aside from not representing the full picture it also looks like garbage. Perhaps there is some mode where I can take control of drawing and decide which pixels to draw myself?