Hello.
In this case, ChartScreenShot help should be taken literally.
align_mode=ALIGN_RIGHT
[in] Output mode of a narrow screenshot. A value of the ENUM_ALIGN_MODE enumeration. ALIGN_RIGHT means align to the right margin (the output from the end). ALIGN_LEFT means Left justify.
This means that when ALIGN_RIGHT alignment is specified, the chart will be forced to scroll to the right border, which is equivalent to executing the command
ChartNavigate(0,CHART_END,0);
This behavior was laid down many years ago (historically). And when the ChartNavigate() function was added, the behavior of the ChartScreenShot function did not change.
Therefore, if you want to get the desired effect, use the value ALIGN_LEFT for the align_mode parameter.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
https://www.mql5.com/en/docs/chart_operations/chartscreenshot
align_mode= ALIGN_LEFT
works as expected, it takes data from the left side of the chart window as much WIDTH as it can but this is not what I want because it misaligns the end of the charts (weekends etc).
So I tried ALIGN_RIGHT (the default) but it appears to ignore the current location of the chart, and only takes a screenshot of the most recent data instead (regardless of the navgated chart setting.0
Try this very simple script on your chart.
1. uncheck autoscroll
2. scroll back to some past time on your chart
3. run the script
4. in your Files/ folder, you will see a screenshot but it is not of the past data you were looking at, it is of the most recent data instead.
Someone please verify.
build 2981