First bar displayed

Questions about MultiCharts and user contributed studies.
Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

First bar displayed

Postby Nick » 08 Aug 2007

This is slightly off topic but is there a way to find the bar number of the first bar you can see on the left of a chart? In easylanguage that is. First bar displayed rather than first bar on chart?

Cheers.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 08 Aug 2007

Hello Nick,

The distinction you make between the first bar on chart and the first bar displayed is pretty vague. Could you please rephrase the question?

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 09 Aug 2007

Hi the first bar on the chart is bar 1 and will quite likely not be seen in the chart window. It will be off the left hand edge some time in the past. Of course it would be there if you scrolled your chart window back


I want to identify the first bar displayed on the screen. That is the the first bar that you can actually see on the left hand side of the window.

Hope that explains it. :D

Thanks in advance,
Cheers.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 09 Aug 2007

Hello Nick,

Just wanted to make sure that I got this right:

If, say, a chart has 100 bars and in the last section 30 bars are displayed: the first visible bar in that last section will be bar 71. Is that what you mean?

Do you happen to know which command in TS identifies this bar?

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 10 Aug 2007

Yes that's exactly it Marina. To be honest I am not even sure that TS can do it. This is why I put it as 'slightly off topic'.

Having said that it is very valuable to label things on the righthand edge where it is nicely out of the way of price action.

It would be nice to know this bar if you widen the bars spacing or re-size your chart,

Cheers,
Nick.

User avatar
ABC
Posts: 516
Joined: 16 Dec 2006
Has thanked: 110 times
Been thanked: 290 times
Contact:

Postby ABC » 10 Aug 2007

Nick,
it's possible in EL/PL:

Code: Select all

GetAppInfo(aiLeftDispDateTime);


aiLeftDispDateTime:
Identifies date and time of the first (leftmost) bar displayed on the chart.
Returns a DateTime(double) value when called from a chart otherwise returns 0.

aiRightDispDateTime:
Identifies date and time of the last (rightmost) bar displayed on the chart.
Returns a DateTime(double) value when called from a chart otherwise returns 0.

Works like a charm, but you'll need to convert the double DateTime, because Date comes as JulianDate and Time are the minutes from 00:00.

Hope that helps,

ABC

Guest

ABC you are amazing !

Postby Guest » 10 Aug 2007

ABC you are amazing !

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 16 Aug 2007

A rather delayed thanks ABC....better late than never.

Cheers.

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 16 Aug 2007

having a small problem extracting the minutes correctly to plot anyidea whats wrong with this?


if LastBarOnChart then begin
jDateTime = GetAppInfo(aiLeftDispDateTime);
FirstBarDate = JulianToDate( IntPortion(jDateTime ) ) ;
FirstBarTime = MinutesToTime( FracPortion(jDateTime ) * 60 * 24 ) ;
Result = Text_New(FirstBarDate, FirstBarTime, Close, "Test1234567890");
end;

Its plotting the text on the correct day but at the first bar of the day? I guess I have misunderstood getting the fractional portion returned by getappinfo into the correct time format for the plot?

Thanks again
nick

User avatar
ABC
Posts: 516
Joined: 16 Dec 2006
Has thanked: 110 times
Been thanked: 290 times
Contact:

Postby ABC » 16 Aug 2007

Nick,
could you share a screenshot, because I tried your code and it does exactly what it should i.e. plotting the text on the first bar to the left of the screen.

Regards,

ABC

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 16 Aug 2007

Sure ...bed time now...I'll do it tomorrow. Thanks for your continued advice on this.

Cheers,
Nick

Nick
Posts: 490
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Postby Nick » 17 Aug 2007

Strangest thing seems to be working now. I'll let you know if it breaks again. Appreciate being pointed in the right direction. Thanks.

Cheers,
Nick


Return to “MultiCharts”