Yes, in addition to the code length, hundreds of indicator buffers would be an awful waste of memory. My variant uses one array with dimension: number of bars on the screen + max. period.
An ultra-fast indicator of hundreds of moving averages, implemented on Canvas.
100 MA lines (period step 10) - time of calculation and displaying on the screen - 4-7 milliseconds
1000 MA lines (period step 1) - time for calculation and display - 20-30 milliseconds.
I haven't tested the code too much. There may be bugs. Implemented only for one pixel thick bar (it is forced to this scale). Also screen refresh rate is not optimized. All lines are calculated and completely output at every tick.
As understood the average is simple? Now would do the same for exponential.
How do you know the average is simple? Now would you do the same for an exponential?
This is just a demo example. All types of MA can be implemented. All you need is your desire and necessity. The code will become a bit more complex with expotential. I suggest you give it a try.
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.
There is a limitation. Up to 512 indicator buffers can be made >>>https://www.mql5.com/ru/docs/indicators
An ultra-fast indicator of hundreds of moving averages, implemented on Canvas.
100 MA lines (period step 10) - time of calculation and displaying on the screen - 4-7 milliseconds
1000 MA lines (period step 1) - time for calculation and display - 20-30 milliseconds.
I haven't tested the code too much. There may be bugs. Implemented only for one pixel thick bar (it is forced to this scale). Also screen refresh rate is not optimized. All lines are calculated and completely output at every tick.
As understood the average is simple? Now would do the same for exponential.
How do you know the average is simple? Now would you do the same for an exponential?
To illustrate the speed...
Changing two parameters via the mouse pointer
X - maximum MA period changes
Y - step of MA period change
To illustrate the speed...
Changing two parameters via the mouse pointer
X - maximum MA period changes
Y - step of period of MA
Pretty, but the compiler blows up
It's beautiful, but the compiler is fighting
The library needs to be installed, of course. There is a link to this library in the code.
Thank you! It's all working!
How do I make the indicator red raw/shift when the chart is redrawn/shifted?
Thank you! It's all working!
How do I get the indicator to redraw/shift when the chart is redrawn/shifted?
That's how redrawing works.
Mine only works when the mouse is moving.
Mine only works when I move the mouse.
Yes, there was a little bug. Fixed it.
Thanks for that.