How to make a screenshot in MQL5 with ALIGN_RIGHT mode

 

Hi,


I've come to a bit of a hiccup. In 1 of my programs, I need to make automated chart screenshots. The function for that is:

ChartScreenShot(chartId, fileName, ss_width, ss_height, align_mode);

Prior to that I

ChartNavigate

to some time in history, where bars_navigated is much larger than visible_bars. I don't need the whole screenshot (whole display), so I set ss_width smaller than Chart_Width:

ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);

If I set the alignment to ALIGN_LEFT, I will get a very nice screenshot of the left part of the screen with the specified "ss_width" pixel width.

However If I set ALIGN_RIGHT, I do not get the right part of the screen, but the right part of the complete chart (so it basically jumps to bar[0]) and makes a screenshot of youngest part of the chart.

So my question is: Is it possible to get a screenshot of the right part of the screen? 

I know one solution is to simply ChartNavigate less and align the chart to the left screen border and use ALIGN_LEFT with that but this solution is messy. And also I'm confused that ALIGN_RIGHT always jumps to Bar[0]; it makes it an ineffective tool.


Any pointer is appreciated.

 

Still looking for MQL5 based solution.

Currently using image tools to modify screenshots :)

 
aries:

Still looking for MQL5 based solution.

Currently using image tools to modify screenshots :)

I didn't experiment it, but as I understood your post and the documentation, that seems a bug (unless I misunderstood), so you should report it to ServiceDesk.
Documentation on MQL5: Chart Operations / ChartScreenShot
Documentation on MQL5: Chart Operations / ChartScreenShot
  • www.mql5.com
Chart Operations / ChartScreenShot - Reference on algorithmic/automated trading language for MetaTrader 5
 

Thank you very much, I was looking for that. I didn't find the bugzilla section before. 

BR

 

hi .

is there a way to take ScreenShots from just one timeframe?

my problem is I take ScreenShots of chart every one min and i change time frame during that time ...

i want to just take ScreenShots from m5 timeframe ...

 
aries #:

Thank you very much, I was looking for that. I didn't find the bugzilla section before. 

BR

Hi, I'm actually facing the same issue and absolutely frustrated about mql5 devs not doing anything for years.
 
Fotikhbek Khusanov #:
Hi, I'm actually facing the same issue and absolutely frustrated about mql5 devs not doing anything for years.

It's not clear what's your problem exactly. If it's about ALIGN_RIGHT, then there is no bug here. You can find more info in the algotrading book:

Parameter alignment affects what part of the graph will be included in the file. The value ALIGN_RIGHT (default) means that the snapshot is taken for the most recent prices (this can be thought of as the terminal silently making a transition on pressing End before the snapshot).

It seems logical for the alignment to the right, if it's requested.

If you need a specific part of the graph, then you can indeed scroll to it by ChartNavigate or manually (ad-hoc or preliminary) and then take screenshot without applying ALIGN_RIGHT.

MQL5 Book: Creating application programs / Working with charts / Saving a chart image
MQL5 Book: Creating application programs / Working with charts / Saving a chart image
  • www.mql5.com
In MQL programs, it often becomes necessary to document the current state of the program itself and the trading environment. As a rule, for this...
 
Stanislav Korotky #:

It's not clear what's your problem exactly. If it's about ALIGN_RIGHT, then there is no bug here. You can find more info in the algotrading book:

It seems logical for the alignment to the right, if it's requested.

If you need a specific part of the graph, then you can indeed scroll to it by ChartNavigate or manually (ad-hoc or preliminary) and then take screenshot without applying ALIGN_RIGHT.

You are right. However, I had to figure it out too (as it is clear from my 2017 answer), there is no bug but the feature is not intuitive at all.
 
Alain Verleyen #:
You are right. However, I had to figure it out too (as it is clear from my 2017 answer), there is no bug but the feature is not intuitive at all.
How would you suggest it to be intuitive otherwise - if it would accept ALIGN_RIGHT on a chart shifted to the left - what do you think it should do?