Barnumber of the first bar displayed on the chart. Possible?

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Barnumber of the first bar displayed on the chart. Possible?

Postby arjfca » 21 May 2012

Hello

Is it possible to get the value of the date and time of the first bar, displayed, on the left side on the chart?

Purpose, adding text to a created trendline via code. The position of the text would then be adjusted for each new first bar on the left

Martin
Attachments
First Bar.gif
(26.39 KiB) Downloaded 235 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Barnumber of the first bar displayed on the chart. Possi

Postby TJ » 21 May 2012

Hello

Is it possible to get the value of the date and time of the first bar, displayed, on the left side on the chart?

Purpose, adding text to a created trendline via code. The position of the text would then be adjusted for each new first bar on the left

Martin
look up

getappinfo

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Barnumber of the first bar displayed on the chart. Possi

Postby arjfca » 21 May 2012

Hello

Is it possible to get the value of the date and time of the first bar, displayed, on the left side on the chart?

Purpose, adding text to a created trendline via code. The position of the text would then be adjusted for each new first bar on the left

Martin
look up

getappinfo
Yes it work
Many thanks

Code: Select all

Var:DateTimeFirstBar (0);

DateTimeFirstBar = getappinfo(aiLeftDispDateTime);
If barstatus[1] = 2 then print (formatdate("dd-MM-yyyy",DateTimeFirstBar), " ", formattime("hh:mm:ss",DateTimeFirstBar));
I should be able to create an indicator to display a trendline with a string starting at the first bar on the left.

First time that I use the GetAppInfo. Interesting.

Martin :)

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Barnumber of the first bar displayed on the chart. Possi

Postby TJ » 21 May 2012

Hello

Is it possible to get the value of the date and time of the first bar, displayed, on the left side on the chart?

Purpose, adding text to a created trendline via code. The position of the text would then be adjusted for each new first bar on the left

Martin
look up

getappinfo
Yes it work
Many thanks

Code: Select all

Var:DateTimeFirstBar (0);

DateTimeFirstBar = getappinfo(aiLeftDispDateTime);
If barstatus[1] = 2 then print (formatdate("dd-MM-yyyy",DateTimeFirstBar), " ", formattime("hh:mm:ss",DateTimeFirstBar));
I should be able to create an indicator to display a trendline with a string starting at the first bar on the left.

First time that I use the GetAppInfo. Interesting.

Martin :)
Good work! Thanks for sharing the code.


ps. please check the bracket on "barstatus[1] = 2"


Return to “MultiCharts”