- www.mql5.com
- www.mql5.com
Just save them when OnDeinit is called.
I want to know the position of chart in respect to datetime, for example i have been browsing the chart from date : 31dec2022 2:37pm , and i want to save this info using ChartGetInteger
and today is 2feb2023 so mt5 open charts for today by default
so next time i open chart, i want to load this info ( 31dec2022 2:37pm ) using ChartSetInteger, so Chart starts from 31dec2022 2:37pm so please inform which function to use for this case?
I can get first visible bar info from
ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);
but how to set?
- www.mql5.com
Use ChartNavigate to re-position the chart's display based on the state you saved.
ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);
but what about CHART_END how do i get its value to save on current chart?
If you know which is the first bar visible, and how wide it is then, then you can calculate the last bar.
Number of the first visible bar in the chart. Indexing of bars is the same as for timeseries.
int r/o
Chart width in bars
int r/o
If you know which is the first bar visible, and how wide it is then, then you can calculate the last bar.
Number of the first visible bar in the chart. Indexing of bars is the same as for timeseries.
int r/o
Chart width in bars
int r/o
CHART_WIDTH_IN_BARS returning wrong info, as you can see in chart i measure there are 35 bars but it shows 45
May I know whats the logic for this?
I am also getting when using ChartNavigate on OnInit ERR_CHART_NAVIGATE_FAILED | 4111 | Error navigating through chart |
- www.mql5.com
No, it is NOT incorrect! You are applying a shift to your chart, which is not measured in bars, but in percentage of the chart.
The size of the zero bar indent from the right border in percents
double (from 10 to 50 percents)
As a programmer you need to start trying to "debug" your own thoughts and logic.
When in doubt, try thinking of possible reasons why and then research the documentation to find the possible causes and solutions.
Programming is about "logic thought", and you can only develop that skill by trying to resolve things yourself.
If every time you hit a "bump" you come running to the forum for an answer, you will never develop that skill in you.
It is like developing your muscles — if every time you need to lift something, you ask someone else to do it, your muscles don't grow.
No, it is NOT incorrect! You are applying a shift to your chart, which is not measured in bars, but in percentage of the chart.
The size of the zero bar indent from the right border in percents
double (from 10 to 50 percents)
As a programmer you need to start trying to "debug" your own thoughts and logic.
When in doubt, try thinking of possible reasons why and then research the documentation to find the possible causes and solutions.
Programming is about "logic thought", and you can only develop that skill by trying to resolve things yourself.
If every time you hit a "bump" you come running to the forum for an answer, you will never develop that skill in you.
It is like developing your muscles — if every time you need to lift something, you ask someone else to do it, your muscles don't grow.
ok thanks for suggestion
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When OnDeInit() and OnInit() is called or when timeframe is changed, MT5 forgets about the last datetime / XY Location of chart where user was browsing history of bars,
How it is possible that i can save these data and call it later? Any functions for that?
I want to save this before OnDeinit() is called :
1. Number of bars available in window
2. Chart scale status
to make sure i can load this setting later