MT4 provides a WindowFirstVisibleBar() function for determining the shift value for the left most bar that is visible on the current chart. I reviewed the IndicatorInferaceUnit.h and I am not seeing an equivalent function for this. So in the absence of not having a API command for obtaining this shift value, does anyone know of a way this could be done programically?
One idea I had was to create a Text Label and position it a left hand side of screen and check the Screen Coordinates checkbox so that it does not move. Then using an indicator issue an ObjectGet command to obtain the OBJPROP_TIME1 value. Unfortunately this did not return a time and instead return the X coordinate integer value. So my next school of thought was to modify my indicator code to set the OBJPROP_SCREENCOORDS property of this Text Label to Zero, then issue same ObjectGet command thinking that this would give me the proper time. Unfortunately this did not do so and instead gave me the same X coordinate integer value.
Any ideas how this could be accomplished?
Is There A Way to Determine First Visible Bar?
-
- Posts: 2
- Joined: Tue Sep 16, 2014 5:53 pm
- neHcioHep
- Posts: 18
- Joined: Sat Nov 21, 2009 5:49 pm
- Contact:
Re: Is There A Way to Determine First Visible Bar?
Hello camster you should try something like this:
Code: Select all
var ChartInfo: TChartInfo;
...
if GetChartInfo(ChartInfo) then
Print('First index = ' + inttostr(ChartInfo.FirstIndex));
-
- Posts: 2
- Joined: Tue Sep 16, 2014 5:53 pm
Re: Is There A Way to Determine First Visible Bar?
neHcioHep, thank you very much for your suggestion! works like a charm!
Who is online
Users browsing this forum: No registered users and 27 guests