Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Manual/programmatically scrolling of chart

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

    Manual/programmatically scrolling of chart

    Hi all,

    I have a question about scrolling inside a Ninja-Chart:

    My backtest application runs outside of Ninja and uses a Chart to display all sorts of information (like highlighting bars, plotting text at price levels, etc). To accomplish this I have "connected" Ninja and my app via an Indicator which gets the draw-this, draw-that commands and then places NinjaScript DrawObjects, etc.

    Now what I want to do is to let the backtest run and make Ninja scroll the display along side:
    Is there a way to tell the Chart: scroll-to-show-Bar(100) ?

    Thanks for any help,

    Tobias

    #2
    Tobias, welcome to our forums - this is unfortunately not supported via our NinjaScript. As a hint you can look into the unsupported ChartControl class and the methods it offers...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello,

      i am trying to make indicator which scrolls chart to specific candle. Does anybody have hint? I am using this construction to make it work:

      System.Windows.Forms.Control[] controls = ChartControl.Controls.Find("scrChart", false);
      hsc = (ScrollBar)controls[0];
      Point rightScroll = new Point(hsc.TopLevelControl.Left + hsc.TopLevelControl.Width - 13, hsc.TopLevelControl.Top + hsc.TopLevelControl.Height - 15);
      hsc.Value = barIndex;

      // Needs to confirm by mouse click
      Cursor.Position = rightScroll;
      mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, Cursor.Position.X, Cursor.Position.Y, 0, 0);

      When i call the function and is visible last bar in chart the scroll function does not proceed correctly.

      Thanks for help

      Comment


        #4
        Hello,

        Thank you for the post, I wanted to follow up to ensure you received a reply on this.

        I am unsure on this topic as this would be outside of the supported code we can assist with through support.

        With this item I am unsure what would need to be done to get this working, because there is no documentation on this topic and it is un supported I will be of little help myself. Our forum members possibly have done this before though so hopefully one of the active members can post on this item if it is possible to correct.

        I look forward to being of further assistance .
        JesseNinjaTrader Customer Service

        Comment


          #5
          Well I hoped that some of forum members could help. Somehow i thought that ninjatrader developers will not be able helping with this (no offence).

          Any one of you there, did you faced this problem?

          Thanks

          Paul

          Comment


            #6
            Hi Bertrand,

            Could you give a slightly stronger hint? I've tried setting a value for the lastBarPainted property, etc. but have not been able to programmatically scroll the horizontal scroll bar all the way to the right.

            Of course, there's clickable icon on the chart that supports this, so somewere, there has to be an associated call to scroll the chart all the way to the right (I also tried using the HorizontalScroll.Value property of ChartControl, ChartForm and ChartPanel, etc.). If someone is aware of how to do this I would appreciate knowing, and am happy to pursue a stronger, unsupported hint...

            Regards,

            Gordon

            Comment


              #7
              Hello grose,

              Thank you for your post.

              Unfortunately this would be unsupported and we would not have any additional information.

              Comment


                #8
                has anyone found a method?

                Comment


                  #9
                  Originally posted by grose View Post
                  Hi Bertrand,

                  Could you give a slightly stronger hint? I've tried setting a value for the lastBarPainted property, etc. but have not been able to programmatically scroll the horizontal scroll bar all the way to the right.

                  Of course, there's clickable icon on the chart that supports this, so somewere, there has to be an associated call to scroll the chart all the way to the right (I also tried using the HorizontalScroll.Value property of ChartControl, ChartForm and ChartPanel, etc.). If someone is aware of how to do this I would appreciate knowing, and am happy to pursue a stronger, unsupported hint...

                  Regards,

                  Gordon
                  Hello grosse,

                  I have solution for NT7, but I can not make it work in NT8.
                  NT7 solution was something like:

                  Code:
                  static ScrollBar        hsc;
                  
                  OnStartup:
                  ---------------
                  
                  System.Windows.Forms.Control[] controls = ChartControl.Controls.Find("scrChart", false);
                  hsc = (ScrollBar)controls[0];
                  I was able to locate the Scrollbar object using code above. And then I located position of left arrow object:
                  Code:
                  int mousePointX = hsc.TopLevelControl.Left + hsc.TopLevelControl.Width - 13;
                  int mousePointY = hsc.TopLevelControl.Top + hsc.TopLevelControl.Height - 15;
                  finaly i performed mouse click to this object and it made chart scroll, In event:

                  Code:
                  hsc.Scroll += new ScrollEventHandler(hsc_OnValueChanged);
                  I had additional logic...

                  Does anyone know how to make this work in NT8?

                  Comment


                    #10
                    Thank you for posting this, kujista. Very nice! I am not using NT8 yet - this will be very useful in some NT7 indicators.

                    Comment


                      #11
                      Thanks to Jim from NT I have much better approach to do that, check this thread https://ninjatrader.com/support/foru...rogramatically

                      Comment


                        #12
                        I am unsure on this topic as this would be outside of the supported code we can assist with through support. feedback survey breakfast hours
                        Last edited by marshsur; 05-17-2022, 09:37 AM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by alifarahani, Today, 09:40 AM
                        6 responses
                        29 views
                        0 likes
                        Last Post alifarahani  
                        Started by Waxavi, Today, 02:10 AM
                        1 response
                        17 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Started by Kaledus, Today, 01:29 PM
                        5 responses
                        13 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by Waxavi, Today, 02:00 AM
                        1 response
                        12 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Started by gentlebenthebear, Today, 01:30 AM
                        3 responses
                        17 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X