Download MetaTrader 5

Graphics in MetaTrader 5: Canvas - drawing inside the buffer with the object snap

To add comments, please log in or register
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2012.03.26 15:15 

The new ResourceCreate function has appeared in build 619 for creation of dynamic graphical resources on the fly.

With this function, you can now create any complex images in 32 bit color (including the alpha channel) and attach them to chart objects.

How can developers benefit from that:

  • programs can quickly create beautiful interfaces without the need to carry lots of files

  • additional resource files (not just BMP and WAV) can be added directly to EX5 files using the # Resource "file name" directive, read at runtime, modified and applied to objects

    ResourceLoad() function will be available in the nearest build. It will allow to read the resources that had been attached to EX5 file some time before

  • it is possible to apply any analytical constructions over a chart managing transparency with the use of alpha-channels

    for example, we can draw a semi-transparent cloud with the prediction of possible market directions by managing color and saturation

  • draw anything on a chart

Soon we will add CCanvas class to the standard library. This class will allow to easily manipulate the images by drawing them in its own buffer with the output to a bound object.

Here is a simple script showing the operation of this class (the files are attached):

#include "Canvas.mqh"
//| Script program start function                                    |
void OnStart()
   CCanvas can;
   for(int i=0;i<10000;i++)

Canvas.mqh 14 kb
Biantoro Kunarto
Biantoro Kunarto 2012.03.27 03:40  

good job

To add comments, please log in or register