Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Determine Scroll to last bar status

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Determine Scroll to last bar status

    Hi All,

    How can I determine programmatically from Ninjascript if the "Scroll to last bar" button is showing on the chart and whether its pointing left or right ?

    Thx !

    Click image for larger version

Name:	20220404_150850_WS2.png
Views:	202
Size:	1.8 KB
ID:	1196532

    #2
    Hello Bidder,

    You could compare the ChartBars.ToIndex to CurrentBar.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Simple and effective. Thank you !

      Comment


        #4
        Update after testing in various scenarios:

        When called from Onbarupdate the comparison of ChartBars.ToIndex to Currentbar works well.
        When called from a timer, though, Currentbar displayed inaccurate values.
        After considering several alternatives I ultimately opted to switch out Currentbar for ChartBars.Count.
        This worked in all scenarios and was easy to implement.

        Here is the final result:

        Code:
        [FONT=Courier New]protected bool RightBarCurrent()
        {
          bool RtnBool = true;
          if (ChartBars.ToIndex+2<ChartBars.Count) RtnBool=false;
          return RtnBool;
        }[/FONT]
        Last edited by Bidder; 04-13-2022, 02:10 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        92 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        23 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        34 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        34 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X