• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
              Patrick H.NinjaTrader Customer Service

              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

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by johnnybegoode, Yesterday, 07:15 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post johnnybegoode  
                      Started by rtwave, Yesterday, 06:55 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post rtwave
                      by rtwave
                       
                      Started by Apeppo, Yesterday, 02:53 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post Apeppo
                      by Apeppo
                       
                      Started by johng964, Yesterday, 01:33 PM
                      2 responses
                      12 views
                      0 likes
                      Last Post johng964  
                      Started by U0000999, Yesterday, 12:07 PM
                      3 responses
                      18 views
                      0 likes
                      Last Post NinjaTrader_ChrisL  
                      Working...
                      X