Replace Chart frame with customised frame with custom components

 

I know there are classes that can be used to draw graphics on the chart, I am developing an indicator that will have lots of graphics and trying to run it becomes very slow, its not an option. So I need to know how I can use if possible the windows api to completely redraw the entire chart, put my custom components. I basically want to hack the entire chart frame and if possible detach it and draw buttons, bordered panels, tabs and text boxes and still have the same access to the chart data API? Any clues, is it possible?

 
tinashe:

I know there are classes that can be used to draw graphics on the chart, I am developing an indicator that will have lots of graphics and trying to run it becomes very slow, its not an option. So I need to know how I can use if possible the windows api to completely redraw the entire chart, put my custom components. I basically want to hack the entire chart frame and if possible detach it and draw buttons, bordered panels, tabs and text boxes and still have the same access to the chart data API? Any clues, is it possible?

I don't think it is possible to use WinAPI to Draw onto the MT4 Charts as they are application-centric. So you will have to use MT4's own Chart Graphic Objects or use the pixel based Canvas class which just uses a normal Bitmap Resource placed on the chart.

The only alternative I see for a a very fast graphical charting system, is to implement your own and totally recreate it as a separate system (as a ".dll") and have an EA continuously feed it the Bar and Tick Data accordingly. However, I do think that will be a rather huge undertaking.

Instead of using Chart Objects, can you not make it use "buffers" instead (at least for the most part)?

Is such a graphical and complex indicator really worth it? Does it really make you trade better? Is it profitable? If the answer is NO to any of these questions, then maybe you should just abide by the well know K.I.S.S. principle.

 

I have written code that uses extremely large amounts of graphics and not noticed any slowdown.

I quite often see in other people's code that they needlessly delete and re-draw graphics every tick for no reason. Make sure that you are not doing this.

 
Well then it looks like i will have to rethink my graphics again. If it does not work out I will try the .dll option. The reason I want it is that the indicator displays good information but it needs to be displayed in an intuitive manner that does not fit the current chart typology.
 
tinashe:
Well then it looks like i will have to rethink my graphics again. If it does not work out I will try the .dll option. The reason I want it is that the indicator displays good information but it needs to be displayed in an intuitive manner that does not fit the current chart typology.

You did not answer GumRai's comments which are in my opinion very pertinent. Although I have never coded complex graphics myself, I have seen such "works of art" using only built-in functionality, and they worked very well and without any slow-down. So his suggestion that you review your code for needless delete/redraw cycles seems very sensible and astute.

 
I am going to do a complete rewrite, and yes I had a lot of deletes and redraw, I will redesign and keep these operations at minimum.
 
FMIC: I have seen such "works of art" using only built-in functionality,
200,000 trendline objects, no problem. Did you see such a picture? (MetaQuotes Software Corp.) - MQL4 forum - Page 39
Reason: