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:	184
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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        29 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        46 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X