How to get count of bars on screen only (not on chart)?

 

Hi everyone.

Does anyone know of a way to compute the bar count of the bars ONLY on the screen, not the total bars on the chart?

An alternative would be to get the earliest datetime on the screen only (not on the chart).

I'm trying to make a fixed-pip grid indicator that doesn't 'shrink' up when the time on the x-axis is stretched back further into the past.

Thanks everyone,
Chris

 
cjcook:

Hi everyone.

Does anyone know of a way to compute the bar count of the bars ONLY on the screen, not the total bars on the chart?

An alternative would be to get the earliest datetime on the screen only (not on the chart).

I'm trying to make a fixed-pip grid indicator that doesn't 'shrink' up when the time on the x-axis is stretched back further into the past.

Thanks everyone,
Chris

Is that what you mean?
int WindowBarsPerChart()
Function returns the amount of bars visible on the chart.

Check the docs:
https://docs.mql4.com/windows/WindowBarsPerChart
 

I believe it is.

Thank you very much.

Reason: