Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Shift Chart Image to Left programmatically ?

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

    Shift Chart Image to Left programmatically ?

    Hi. This is all about reducing network I/O required in remote interactive
    sessions.

    So, when working on remote, which so many do whether they use
    a VPS or a Dedicated Server; the RDP protocol application, or even
    a Linux version such as xfreerdp has a very difficult task, which is to
    replicate the server's interactive screen locally over the network.

    By dragging the chart image to the left (revealing the Left Arrow Symbol)
    the network traffic can be reduced significantly; as the entire chart
    image doesn't have to be shifted left nearly so often.

    I'm sure you all know about this. So my question is whether the
    Chart control which shifts the chart image to the left (which can be
    done with a Mouse drag left) is accessible programmatically, say,
    with a custom Indicator; so that, periodically, the chart to be moved
    left and be allowed to fill out to the right, with a lot less network I/O.

    Ideally; a Chart Property could set the chart to automagically shift
    to the left, say, leaving 20% of the area blank to be filled in, and
    then when the chart approaches the right margin, do the shift
    again, etc.

    Maybe my clumsy explanation makes no sense; but if there is a
    variable which an Indicator could periodically use to Shift the
    chart left as it approaches the right margin; then a HUGE amount
    of unnecessary remote desktop type I/O could be eliminated
    for many chart types.

    Very fast charts, such as Tick(1) or Seconds(1) result in a huge
    amount of "shifting the entire chart left" nearly constantly; and
    that I/O should be able to be minimized, even if it can't be
    eliminated completely, I think.

    Ninja Charts are very well engineered, and could achieve this,
    if I only knew how !? ...

    Maybe there's a solution available; or maybe I can write some
    custom code to achieve this? Any solutions or suggestions
    are very welcome ! Thanks in advance.

    hyperscalper

    #2
    Hello Hyper,

    Thank you for the post.

    There is not a supported api for controlling the chart movement but you could try to issue keyboard commands for what you want to do if there is a command that applies to that. You can move the chart around using the arrow keys, also the home/end pageup/pagedown buttons. To learn about issuing keyboard commands you can see what is being used in the rollover indications indicator on the user app share: https://ninjatraderecosystem.com/use...indications-2/



    I look forward to being of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi. OK, if there really is no accessible API; I'd like to request that that be made available in
      a future version of the Charting. An indicator would need to know how far (probably in a
      percentage of the visible chart area left to right) the chart is scrolled to the left; and also be
      able to direct the chart to scroll to the left by a percentage again, so that the indicator
      would be able to maintain a range of percentage left-scrolling.

      I'm sure you already know that this may reduce charting I/O by >90% when scrolling
      left is used; in most typical situations; so I'd regard this as an easy implementation
      which would be very valuable; provided users were aware of the benefits when they
      are using NinjaTrader on a remote connection.

      IF it's not too much trouble; having this built-in to the Chart's properties, to activate a
      minimum and maximum percentate left-scrolling as a user selectable action, would be
      even better !!! As I said, this reduces I/O by a huge percentage; so everyone could
      benefit, who are not using NinjaTrader on their local workstations.

      Thanks for everything you do !!
      hyperscalper

      Comment


        #4
        Hello Hyper,

        Thank you for the reply.

        Unfortunately the description you are providing is difficult to follow as far as what the problem is and how scrolling helps. If you have a more simple description of what you are requesting I can take a look if we have something that matches that to add a vote. Also I am not certain what you mean by having a minimum and maximum percentage of left scrolling, do you mean to reduce the data on the chart or have a larger right side margin?

        The Chart objects have some properties that can be set like right side margin if you are trying to just visually push the bars left. I am otherwise not certain what the overall goal is in order to better assist here.
        https://ninjatrader.com/support/help...properties.htm

        You can otherwise look into C# ways to control the chart as you are asking, that could include using keyboard commands or any general C#/WPF commands that may be needed for the task. You can access the window or ChartControl to gather properties of it including the visible bar indexes or where it is in time. You may want to take a look through the help guide Charts section to get an idea of whats already exposed and what you can use:

        https://ninjatrader.com/support/help.../nt8/chart.htm
        https://ninjatrader.com/support/help..._fromindex.htm



        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 12-07-2020, 11:52 AM.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Hi. Basically instead of having the chart "slide to the left" all the time in small
          increments; the "jump to the left" is what we want to achieve here.

          I will look into the properties you reference; and maybe there is the ability
          to achieve this with a simple Custom Indicator, but here's my amended
          attempt to explain what I think should be implemented.

          So, we want to "jump to the left" when data approaches the right
          boundary. It's like "auto dragging the scroll" to the left, leaving, for example,
          33% of the chart BLANK into which new Bars are drawn. There is
          generally no, or very little change to the leftmost 66% of the chart,
          and so Remote Viewers see no "pixel changes" and so they do not
          need to transmit any data.

          Yes, occasionally, on events like re-scaling of the chart; or things
          like that, yes, data will change to the left of the "active bar"; but things
          can be arranged so that there is essentially "no change" to the left
          of the active bar being written and, crucially, there is no "sliding/scrolling
          to the left of the entire chart image" when each Bar is written.

          The "jump scrolling" occurs only when the active bar is being written at
          the rightmost margin; and therefore, the entire chart would need to "slide
          to the left". It is at that point that we want to trigger the next "jump to the
          left" so that many many new bars can be written without requiring that
          the entire chart image be written.

          Run a Tick(1) chart; and every time it hits the right boundary, grab the
          entire chart image inside, and DRAG it to the left, maybe 50% of the left/right
          distance. Then you'll see that essentially *nothing* needs to be rewritten
          to the LEFT half of the chart (the image remains static) until the Tick
          chart reaches the right margin. This has saved an enormous amount
          of I/O between the Remote Server, and the local Viewing Terminal.

          Yes, occasionally things change to the left of the active bar but, as I said,
          Indicators, etc, can be arranged so that there is Little to No Update to
          the left of the active bar; and the new Bar is written with no scrolling
          to the left.

          Other minor tweaks include hiding horizontal and vertical grid lines
          which, again, may move causing all or part of the image to be updated.
          Any "pixel change" will require remote viewing software to transmit
          data, of course;

          THANK YOU.

          Hope that helps your understanding.
          hyperscalper
          Last edited by Hyper; 12-08-2020, 12:14 PM.

          Comment


            #6
            Click image for larger version

Name:	Scroll-left-screenshot.png
Views:	555
Size:	82.4 KB
ID:	1131312

            Here's a Fast 4 Tick chart, with high performance Custom Indicator,
            having been manually dragged Left. Future bars are written
            without the need to rewrite anything to the left of the current
            bar; and consequently avoiding all of that I/O and latency.

            Anyway, I'd be happy if the relevant properties were controllable by
            a Custom Indicator I could write; however, I don't see what would
            probably be needed. Indicator would need to be able to discover
            the Rightmost new Bar offset from the Right Margin; to determine when to
            alter it; and then be able to specify the equivalent of a Drag the Chart
            Left with the Mouse effect. (probably specified as a percentage of
            the overall Chart's width)

            If you were to put this in an Enhancement List, nobody's gonna vote
            for it, unless you emphasize that anybody using a VPS or Dedicated
            Remote Server can achieve much lower latencies and bandwith
            consumption if they are using "fast" charts. Then I'm sure they
            would jump on the request.

            The capability is already in the NinjaTrader Charting system, but
            it may not be exposed. After all, Dragging Chart contents to the
            left, achieves exactly what we want to do programmatically; plus
            the ability to know when the bar is close to the right margin.

            Just remember, not everyone uses NinjaTrader on a local desktop;
            and those of us who use remote Servers will love the ability to do this
            Auto Jump Scroll periodically and automatically, instead of manually
            Dragging the Chart image to the left all the time (even if we have to write our own
            Indicator code to make it happen).


            hyperscalper
            Last edited by Hyper; 12-08-2020, 01:22 PM.

            Comment


              #7
              Hello Hyper,

              For these type of changes you would need to look into using C# means to do that. I am unable to find a feature request that matches the details to add a vote so this would be something you would need to research in code if you wanted to do that.

              Preventing the chart from advancing is not something which there are any means to control by supported NinjaScript. The only way to prevent a chart from advancing would be to manually move the chart so its no longer tracking the current price and then it would not try to move as new bars are created.

              You could look at other options like hiding the previous price bars and only drawing the last few bars by using a chart style.

              Please let me know if I may be of further assistance.

              JesseNinjaTrader Customer Service

              Comment


                #8
                Hi. OK, you can't find a feature request; so let me put one in for
                this feature. Please let me know how to do that.

                You've tried to help me, help you to understand this feature request;
                but I'm not feeling like I got a satisfactory answer.

                I can start with a NinjaScript skeleton, and then code up any facility;
                provided it's accessible from C#; as you say, so then I know that
                so many support people will at least try to point someone like me,
                in the right direction?

                Practically everything I do is "unsupported" since I'm asking for
                advanced functionality; and that's OK; I'll take responsibility and
                just asking for some hints and tips; I'll take it from there.

                hyper
                Last edited by Hyper; 12-08-2020, 02:57 PM.

                Comment


                  #9
                  Just guessing, there is a NinjaTrader.Gui.Chart.ChartControl class with properties
                  CanvasLeft and CanvasRight. I notice that they are readonly; having only get methods.

                  Possibly if CanvasRight could be assigned, but that's mere speculation. A Mouse Drag
                  Left sets some offset to CanvasRight, perhaps; and that is the offset I'd seek to control.

                  When the body of the Chart is Mouse Dragged to the Left, and the <- Arrow is shown
                  on the chart; can you give me some clues as to which variables are involved?

                  That would possibly get me started. I'll look into custom charting also.

                  Comment


                    #10
                    Hello Hyper,

                    Your post here is enough to put in the request so it is documented. If there is an existing feature that development is already tracking we can also add votes to that to show its popular. If we can't match it up then the post would be the request. As your post is fairly detailed and I was not able to find an existing request which matches the descriptions you gave, if you have a more simplistic description of what you wanted as the feature request for the platform I can double check for that.

                    From the given details its unlikely that a feature request will be the way forward, you will very likely need to implement something custom here if you want to change how the chart progresses.

                    The way I see it some of your options here include using the WPF framework to send key events to move the chart. WPF mouse events could be simulated and sent to the chart. A ChartStyle can be used to render only a few bars of the chart. You may be able to use a combination of moving the chart and the End key if you need to get back to the CurrentBar.

                    Practically everything I do is "unsupported" since I'm asking for
                    advanced functionality; and that's OK; I'll take responsibility and
                    just asking for some hints and tips; I'll take it from there.
                    We are more than happy to provide hints or tips where we can. We would just ask that you try and provide a very specific question if you need hints toward a goal. Instead of providing additional details on how this could help performance or throwing out ideas a better way towards solving this would be to provide a more simple question about what you need help doing. You have provided some various ideas in your last post, if you are trying any of those and having trouble moving forward post what you have along with what you needed to do. Here is something you said just to provide a quick example,
                    Indicator would need to be able to discover
                    the Rightmost new Bar offset from the Right Margin;
                    An indicator can see what the right most bar index is and also can gather the right margin from the chart controls properties. There are additionally methods for finding the X of a bar in the chart. If your having trouble with one of these tasks try asking more directly "How can i get the right most bar or how can I get the charts Right side margin. etc.

                    When the body of the Chart is Mouse Dragged to the Left, and the <- Arrow is shown
                    on the chart; can you give me some clues as to which variables are involved?
                    The chart is dragged so the chart internal logic is no longer following the current bar. That is because you scrolled to a point in time. If you mean, what would you need to know the chart is not following the current bar you could compare the ToIndex with the CurrentBar index to get an idea if your at the last bar on the chart or not. The FromIndex and ToIndex properties are mainly used for rendering but can also be used to know where the chart is scrolled to or if its at the end of the data.



                    I look forward to being of further assistance.








                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Hi. Well, I have to say you certainly do respond to user
                      comments. I've really tried to explain what I'm looking for,
                      but I feel you don't even recognize the immense value of
                      reducing Chart I/O over a remote connection. Perhaps NinjaTraders
                      are desktop local users, and Ninja is itself a desktop application;
                      and, yes, networks are fast; but I guess since slow modems went
                      out the window; nobody cares about optimizing Remote Desktop
                      style updates. So there's not a lot of experience in the younger
                      crowd; as concerns optimizing/minimizing I/O over the network.
                      Having made that observation, let me try to explain what I want
                      to do.

                      MANUAL version:
                      1) Tick chart is advancing in an active market. Using the Mouse,
                      drag the chart (and panel indicator contents) to the Left quickly so
                      that 50% of the chart is on the left; and the other part of the canvas
                      is BLANK.
                      2) When bars advance to touch the Right Margin; just do it
                      again.
                      Between these "Jump Scroll Actions" the bars to the left of
                      the chart image contain Pixels which can be arranged to remain
                      constant (with few exceptions); so I/O on remote is reduced
                      very very significantly.

                      AUTOMATIC version:
                      (do the above automatically)

                      After all of my attempts at explaining this, I hope that 1) it is clear the enormous
                      benefits in reduction of remote traffic, and 2) that NinjaTrader charts would need
                      only trivial effort to make this possible.

                      I feel stupid; since I was not able to communicate all of this
                      very simple idea in a compelling way; and maybe someone
                      will come up with (or expose) the very simple set of variables which I
                      could use to implement this continuously on a chart.

                      NinjaTrader support group always goes "above and beyond"
                      what is technically supported; and I certainly appreciate that.
                      IN NO OTHER standard retail platform could I have accomplished
                      ridiculously fast and complex Order Entry and Indicators as are
                      possible with NinjaTrader and C# (even though my native
                      language is Java; C# is so obviously similar that the inter-language
                      translation is trivial). I really appreciate that...

                      THANKS
                      hyper
                      Last edited by Hyper; 12-08-2020, 08:58 PM.

                      Comment


                        #12
                        If I can do it; I'll upload a video showing what I mean.
                        As you can see, NO trading is being done here; since,
                        of course, the trader is occupied in the "drag left" all the
                        time, since it is not automated. And you'll also see that
                        (for the most part) to the left of the active Bar (this is
                        a single Tick chart) there is NO change to the image
                        which allows the I/O to the remote server to be minimal.

                        [well, my video exceeded your max size, so I'll see
                        whether I can trim it later, and upload it]

                        Here is it on YouTube; so I hope it helps to understand
                        what I'm requesting the possibility of automating.


                        [edit] For the real nitpickers here; YES, there is a redraw
                        of the screen but, because it is buffered; from the perspective
                        of the Remote Viewing software; MOST pixels do not
                        change and, therefore, they do not need to be transmitted
                        to the viewing client. Of course you understood that, but
                        it seems I have to make it really obvious, just to make
                        sure since most people don't think about the network
                        load of replicating a fast changing screen on remote;
                        to a local viewer.

                        hyperscalper
                        Last edited by Hyper; 12-09-2020, 11:21 AM.

                        Comment


                          #13
                          Hello Hyper,

                          Thank you for the additional details.

                          This should be more than enough details to sort through to see if anything matches to add votes. The feature request is otherwise in place with your post here.

                          As previously noted these type of changes are unlikely to be implemented through feature requests. You can certainly peruse building these type of modifications using NinjaScript and the routes we have discussed previously in this thread.

                          If you have any questions related to scripting we can try to work through that but we would need a direct question about what you need help with related to what you are trying in code.


                          Please let me know if I may be of further assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            Hi. Thanks. So, JUST TO WRAP THIS UP, there is no way I can code that behavior
                            with existing API's (simplest would be Indicator subclass) or is there a way I can code that now ??
                            THANKS,
                            hyper

                            Comment


                              #15
                              Hello Hyper,

                              What behavior specifically are you asking to code? Moving the chart to the left?

                              You can likely code parts of what you described but I don't know what part you are referring to in order to say yes or no.

                              What you are asking about is not supported so any solution here will be one that you come up with, very likely involving the WPF keyboard or mouse events and issuing your own events to make the action you want happen.

                              The type of NinjaScript that is used would likely need to be an indicator as you are trying to affect the chart panel while its being used.


                              Please let me know if I may be of further assistance.

                              JesseNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post trilliantrader  
                              Started by mgco4you, Today, 09:46 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by wzgy0920, Today, 09:53 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post wzgy0920  
                              Started by Rapine Heihei, Today, 08:19 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by Rapine Heihei, Today, 08:25 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post Rapine Heihei  
                              Working...
                              X