How to change the charts by MQL5?
- Hide an object when the scale of a chart changes
- how to check new bar when EA running on offline chart?
- Indicators with alerts/signal
Question unclear. Change the chart to a different symbol or change the chart positioning?
ChartSetInteger(0, CHART_SHIFT, true);
If you want the chart to navigate to the newest tick:
ChartNavigate(0, CHART_END);
If you are using it inside the OnTick() event handler in your EA, or OnCalculate() in your Indicator, then obviously it will not be called when there are no incoming ticks (e.g. weekend).
So, you have to use in one of the other even handlers, like OnTimer() or OnChartEvent(), but it depends on the situation and what you are trying to achieve.