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
Barnumber of the first bar displayed on the chart. Possible?
Barnumber of the first bar displayed on the chart. Possible?
- Attachments
-
- First Bar.gif
- (26.39 KiB) Downloaded 235 times
- TJ
- Posts: 7743
- 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
look upHello
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
getappinfo
Re: Barnumber of the first bar displayed on the chart. Possi
Yes it worklook upHello
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
getappinfo
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));
First time that I use the GetAppInfo. Interesting.
Martin
- TJ
- Posts: 7743
- 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
Good work! Thanks for sharing the code.Yes it worklook upHello
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
getappinfo
Many thanksI should be able to create an indicator to display a trendline with a string starting at the first bar on the left.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));
First time that I use the GetAppInfo. Interesting.
Martin
ps. please check the bracket on "barstatus[1] = 2"