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:	115
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 Brevo, Today, 01:45 AM
        0 responses
        3 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        239 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        6 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X