ChartNavigate in MT5

 
Hello developers.

I've been trying to make 200 candle distance between the last candle and end of the chart. but whatever I tried does not work. The code I use is as fallows.

bool res=ChartNavigate(ChartID(),CHART_END,-200); 

I also use  ChartNavigate(ChartID(),CHART_END,200); but did not work. Please let me know what code can do such a task.


Thanks in advance.

 
Fatemeh Ameri:
Hello developers.

I've been trying to make 200 candle distance between the last candle and end of the chart. but whatever I tried does not work. The code I use is as fallows.

bool res=ChartNavigate(ChartID(),CHART_END,-200); 

I also use  ChartNavigate(ChartID(),CHART_END,200); but did not work. Please let me know what code can do such a task.


Thanks in advance.

No one knows about this issue? Is it a bug in MT5? Or I should change the code?

 

Here is the MT5 function list: https://www.mql5.com/en/docs/function_indices

One can search with ctrl-f e.g. for Chart and you would find this https://www.mql5.com/en/docs/chart_operations and there https://www.mql5.com/en/docs/chart_operations/chartnavigate (incl. an example).

On the other hand focus on the Chart and press Enter then a little field appears, enter 2022.01.10 and press Enter again and see what happens :)

Documentation on MQL5: List of MQL5 Functions
Documentation on MQL5: List of MQL5 Functions
  • www.mql5.com
List of MQL5 Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fatemeh Ameri: I've been trying to make 200 candle distance between the last candle and end of the chart. but whatever I tried does not work. The code I use is as fallows. bool res=ChartNavigate(ChartID(),CHART_END,-200); I also use  ChartNavigate(ChartID(),CHART_END,200); but did not work. Please let me know what code can do such a task.

The function ChartNavigate is for scrolling the chart data left or right (older or newer data) . It is not for creating an indent or empty space on the right hand side of your chart.

To set the indent or empty space on right-hand side of the chart use the function ChartSetInteger() with the property CHART_SHIFT to enable or disable it, and the function ChartSetDouble() with the property CHART_SHIFT_SIZE to set the size of the indent or empty space. Please note that the units for the indent or space is in percentage of the chart and not in bars.