Hello,
how can I find the barnumber of the leftmost bar displayed in the current chart ?
Best regards.
Massimo
How to get the BN of the leftmost bar on current chart ? [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: How to get the BN of the leftmost bar on current chart ?
Hello,
how can I find the barnumber of the leftmost bar displayed in the current chart ?
Best regards.
Massimo
Look up the following keywords:
GetBarNumber
GetAppInfo
aileftdispdatetime
Re: How to get the BN of the leftmost bar on current chart ?
Thanks TJ,Look up the following keywords:
GetBarNumber
GetAppInfo
aileftdispdatetime
but I need to find the bar number of the leftmost bar currently in the chart, not the datetime!
I do not see how to achieve that with those keywords.
Best regards.
Massimo
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to get the BN of the leftmost bar on current chart ?
If you know the DateTime value of the leftmost bar, you can compare that with the `DateTime` value of the recent price bars to see whether that bar is the leftmost bar or not. You probably need to create a loop for that, and then check if each recent price bar has the time of the leftmost bar.but I need to find the bar number of the leftmost bar currently in the chart, not the datetime!
I do not see how to achieve that with those keywords.
You can also place a drawing on that leftmost bar and then use `Arw_GetBarNumber()` or `Text_GetBarNumber()` as TJ suggested. Then if you know that bar number you can compare it to the current bar number (probably `CurrentBar`).
Re: How to get the BN of the leftmost bar on current chart ?
Thanks TJ and JoshM,You can also place a drawing on that leftmost bar and then use `Arw_GetBarNumber()` or `Text_GetBarNumber()` as TJ suggested.
now I got it.
Code: Select all
value1=getappinfo(aileftdispdatetime);
value2=getappinfo(aiLowestDispValue);
text_delete(value5);
value3=text_new_dt(value1,value2+5,"");
value4=text_getbarnumber(value3);
text_delete(value3);
value5=text_new_bn(value4+10,value2+1,numtostr(value4,0));
Massimo