Hi all,
I would like to know how to change the size of the chart using MQL5. It seems that chart properties related to width and height are read-only. I can not believe that this is not possible, despite the fact that I have tried to search for a solution for a long time. The problem is that I want to take a screenshot of a specific size that spans all the chart. If I take a screenshot with a specific resolution different from the chart window, it will only span through that area. The simple solution would be to set by hand the chart size but I guess it is also not possible to do it with specific pixel values. Furthermore, I want to be able to set the chart size using code.
Thanks very much for your attention and hope anybody gives me a solution,
Javier
I don't understand your problem, you can do that without any problem seems to me :
MetaTrader Trading Platform Screenshots
MetaQuotes Software Corp., MetaTrader 5, Demo
A chart with custom dimensions
MetaTrader Trading Platform Screenshots
MetaQuotes Software Corp., MetaTrader 5, Demo
Same chart, maximized, but choosing "Active chart 940 x 160 pixels"
Hi all,
I would like to know how to change the size of the chart using MQL5. It seems that chart properties related to width and height are read-only. I can not believe that this is not possible, despite the fact that I have tried to search for a solution for a long time. The problem is that I want to take a screenshot of a specific size that spans all the chart. If I take a screenshot with a specific resolution different from the chart window, it will only span through that area. The simple solution would be to set by hand the chart size but I guess it is also not possible to do it with specific pixel values. Furthermore, I want to be able to set the chart size using code.
Thanks really much. My concern was about the fact of changing the size of the chart from code. Anyway, I have just realized that there was a bug in my code that did not allowed me to call chartscreenshot correctly.
Thanks anyway for the replay
- www.mql5.com
You don't need to change the size of the chart window to be able to take a screenshot of a specific size. Use ChartScreenShot() and specify the X and Y sizes ( width and height ) in pixels.
Hi, I have just realized that there was a bug in my code and that is the reason why I couldnt get a proper image using ChartScreenShot. It was an stupid bug but your answer made me check it again, so I found the problem. Thanks very much
Hi, I have just realized that there was a bug in my code and that is the reason why I couldnt get a proper image using ChartScreenShot. It was an stupid bug but your answer made me check it again, so I found the problem. Thanks very much
Thanks really much. My concern was about the fact of changing the size of the chart from code. Anyway, I have just realized that there was a bug in my code that did not allowed me to call chartscreenshot correctly.
Thanks anyway for the replay
RaptorUK:
Glad to hear you found a fix :-)
Hello again,
I did not finally find a bug in my code!!! Actually, Metatrader5 is not indeed performing well. The problem arises when you want to save the image with a "width" resolution smaller than the one of the chart window. Then, it will only take the portion of the image corresponding to that resolution. If the "height" resolution is smaller, then no problem. It will scale the image perfectly. This problem happens either by code or just by saving the image with "save as picture".
Hello again,
I did not finally find a bug in my code!!! Actually, Metatrader5 is not indeed performing well. The problem arises when you want to save the image with a "width" resolution smaller than the one of the chart window. Then, it will only take the portion of the image corresponding to that resolution. If the "height" resolution is smaller, then no problem. It will scale the image perfectly. This problem happens either by code or just by saving the image with "save as picture".
As I understand, MQL5/MT5 works as intended by the documentation, so it perform well but not as YOU intend ;-)
EDIT: Seems there is no way to change the width of chart (window) by code.
Hello again,
I did not finally find a bug in my code!!! Actually, Metatrader5 is not indeed performing well. The problem arises when you want to save the image with a "width" resolution smaller than the one of the chart window. Then, it will only take the portion of the image corresponding to that resolution. If the "height" resolution is smaller, then no problem. It will scale the image perfectly. This problem happens either by code or just by saving the image with "save as picture".
My chart window gives a full size image of 1679 x 672
so I shouldn't be able to save a chart of 1600 x 700 ? like this one ?
Width is smaller, height is larger . . . did I misunderstand the issue ?
- 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 all,
I would like to know how to change the size of the chart using MQL5. It seems that chart properties related to width and height are read-only. I can not believe that this is not possible, despite the fact that I have tried to search for a solution for a long time. The problem is that I want to take a screenshot of a specific size that spans all the chart. If I take a screenshot with a specific resolution different from the chart window, it will only span through that area. The simple solution would be to set by hand the chart size but I guess it is also not possible to do it with specific pixel values. Furthermore, I want to be able to set the chart size using code.
Thanks very much for your attention and hope anybody gives me a solution,
Javier