Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing non-price data to a chart

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

    Printing non-price data to a chart

    Hello -

    This is specific to NT 8.0.0.9.

    I have an indicator that calculates a ZScore (a datapoint in a standard distribution) based on an algorithm which processes price and volume data.

    So in the indicator, I do all the algorithm processing in OnBarUpdate. The ZScore of the algorithm needs to be charted; not the bar/price data. I have attached a sample output that I created in NT 7 overriding the PLOT method. Note that NT still prints the price data on the Y axis.

    How do I disable printing of the price data to the chart and print just the indicator ZScore data? Is there a method or methods that I can use to tell NT 8 not to print bar data? Also the problem with NT 7 is that once the data reached the right-hand side of the Graphics object, it reset. I want to be able to scroll-through the data.

    What method in NT8 is the best to use to print this out?

    Thanks,
    Mark
    Attached Files

    #2
    Hello,

    Thank you for the question.

    Because this is in an indicator, there is really no way to completely remove the underlying bars so the chart would in turn need bars for the indicator to work. You could make them Transparent from the indicator but you would still have the Scale on the right there is no way to avoid that. Also a ChartStyle could make them transparent or just not draw the bars at all but the scale is still present.

    One idea would be using a ChartStyle instead of an indicator for displaying the calculated levels.

    In a chartStyle you control what you render, so if the logic could fit into a chart style that may be the best choice as it would not render the bars if you do not choose to but would allow you to use the OnRender to draw whatever you need on the chart.

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

    Comment


      #3
      As ntJesse said you have to have bars.

      I move my indicator to a separate panel and compact down the bars for the chart and use plot.

      For example, my laptop battery indicator i wrote.

      Last edited by sledge; 03-01-2016, 12:08 PM.

      Comment


        #4
        Hi Jesse -

        Thanks for your reply.

        Do you mean create my own Chart Style? The help guide says I can create my own:


        If I understand you correctly, I add a new enum for my own chartstyle that does not paint bars but instead is designed to print the ZScore data for the specific indicator I have created?

        Can you please comment if that is what you mean?

        Thanks,
        Mark

        Comment


          #5
          Hello,

          Yes you can create your own ChartStyles now, For further clarification here are some options:

          A) Set the bars to transparent from the indicator which ultimately may be easier.
          B) Use a ChartStyle if the logic allows for this specifically.

          What I had mentioned before was that if the logic you are using can be applied solely in a ChartStyle or more specifically meaning that the logic does not require it to be in an indicator, you could utilize the OnRender from the ChartStyle to draw whatever you need to on the chart without bars being displayed.

          For example if you only used OHLC data for calculating the line positions, you could create a ChartStyle that contains that calculation and draws the lines from the ChartStyle.

          If instead you need to call on other indicators, us OnMarketData or any other Indicator specific overrides/methods/properties you would want to just use a Indicator by its self as that would be the least amount of steps/work.

          In the case of using just a indicator, you could just set the bars to transparent and draw what data you need.

          If you need other Scales than what the Price bars are providing you could also change that. I.E. the indicator plots at values from 0 to 50 but the price of the instrument is 1000, you could change the scale to be 0 - 50 ignoring the price bars if needed. http://ninjatrader.com/support/helpG...b=calculatemin

          I am unsure of what the indicator requires for its logic so I would be leaning toward using only a indicator for this unless the logic you use is simple enough that it can be put into a ChartStyle.

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

          Comment


            #6
            Hi Jesse -

            I thought about this some more. I am unsure I can write a ChartStyle to write non-price data to a chart that I add my custom ChartStyle to. This looks like it will only act on price data, but allow a custom format of that price data. Is this not correct? Is there a way to pass in a specific Data Series to the Chart Style? The only way I can see is the ChartBars object. Can I create my own ChartBars with my indicator data instead of traditional BAR data?

            I looked further into the online documentatnoi and I saw that NT8 now has a generic ISeries that allows for Custom development. It looks like I can create my own series:



            Why would someone want to create their own Custom ISeries? Could I pass the output of my statistical algorithm into this series and print this out on the chart? If I plotted this, would I need to set the Bars to transparent? Would they be printed at all if I plotted the data I added to my Custom ISeries?

            Thanks,
            Mark

            Comment


              #7
              Hi Jesse -

              On investigating further, I don't think this will work. It stores just for the current number of bars.
              I need to store data for each incoming tick for a given bar. And I don't want to create a 1 tick chart.

              This part of my question is still relevant:

              "I thought about this some more. I am unsure I can write a ChartStyle to write non-price data to a chart that I add my custom ChartStyle to. This looks like it will only act on price data, but allow a custom format of that price data. Is this not correct? Is there a way to pass in a specific Data Series to the Chart Style? The only way I can see is the ChartBars object. Can I create my own ChartBars with my indicator data instead of traditional BAR data?"

              Thanks,
              Mark

              Comment


                #8
                Hello,

                Thank you for the reply.

                Yes this is why I said if the logic permits to be used in a ChartStyle, it could be used, otherwise a Indicator would be needed. I do not know the logic you are using so you would need to make the decision on if that would work or not for the logic you need.

                Regarding the remaining question, again I am unsure of the logic being used so I am not entirely sure what the need for the passing the dataseries would be. In general, no it would not be correct to pass an object to the ChartStyle, the ChartStyle would be used to produce results based off of the Price Data that is being reported.

                I believe because of the questions here an Indicator would ultimately be the best choice and to just use the steps in post 3 to hide the chart panel.

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

                Comment


                  #9
                  Hi Jesse -

                  I spent most of Saturday sifting through the forum and found this post: http://ninjatrader.com/support/forum...ad.php?t=80123

                  So far I did this

                  1) Add a class called ZScoreWindow that subclasses NTWindow
                  public class ZScoreWindow : NTWindow
                  {
                  public ZScoreWindow()
                  {
                  Caption = "ZScore Window";
                  Width = 500;
                  Height = 500;
                  }
                  }

                  2) This class is outside of the Indicator Class
                  3) Inside (State == State.Configure) I am creating the new window with
                  Globals.RandomDispatcher.BeginInvoke(new Action(() => new ZScoreWindow().Show()));

                  I have added this code and I can create the NTWindow everytime the indicator loads. This is exactly what I want: the Window outside of my chart.

                  I am attaching the JPEG of what I want to print to this window.

                  Is it doable to draw the contents of the JPEG to the NTWindow class?

                  Thanks,
                  Mark
                  Attached Files

                  Comment


                    #10
                    Hello,

                    Thank you for the reply.

                    It is certainly possible to make a new window but that new window does not have a chart control so drawing would be highly different.

                    I would be unable to really recommend a way to plot the values from a Indicator in a WPF window as they are using completely different rendering.

                    In a Chart, everything you see is being rendered by SharpDX and a ChartControl. The Panels and scales, indicators etc.

                    In the window you have created, you are not working with a ChartControl or OnRender at all but instead with WPF controls such as Buttons, Grids, and other user interface items. The two are completely different so there would be no easy way to draw the same graphic in an arbitrary window.

                    You could certainly use this route and likely come to an end but it would be highly complex compared to the alternatives and I could not suggest a single resource on how to implement this all in a new window. You are essentially needing to recreate a whole chart window and just hide the data series so only the indicator is displayed.

                    I would still stick by my prior answer in post #8 as it is the most complete answer at this point, to adjust the chart panel to hide it and to use the already existing indicators panel for rendering.

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

                    Comment


                      #11
                      Hi Jesse -

                      The suggestion of adjusting the chart panel to hide the price data doesn't allow me to make use of the powerful new graphics capabilities in NT 8.

                      Even in NT7 I could override the Plot() method and use the graphics object which I would draw on top of an existing chart. However it had considerable limitations and was unstable.

                      As I need to process real-time incoming tick data by a specific algorithm and then chart this data outside the scope of a given bar size, I need a separate chart type not tightly coupled to the underlying data like the other chart types are.

                      So the ability to create my own WPF object is extremely powerful for me.

                      I have found an excellent book:Pro WPF 4.5 in C# - Fourth Edition. Already I am able to print basic controls to my NTWindow.

                      I think NinjaTrader should add more documentation to help others like myself get started on doing such development. By officially exposing these interfaces, there really should be some good intro documentation on how to do it.

                      Anyways - thanks for your help and support.

                      NT is a great product.

                      I will post the basic framework of my code to show others how to do the same once I am done.

                      Best,
                      Mark

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by inanazsocial, Today, 01:15 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jason  
                      Started by rocketman7, Today, 02:12 AM
                      0 responses
                      6 views
                      0 likes
                      Last Post rocketman7  
                      Started by dustydbayer, Today, 01:59 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post dustydbayer  
                      Started by trilliantrader, 04-18-2024, 08:16 AM
                      5 responses
                      22 views
                      0 likes
                      Last Post trilliantrader  
                      Started by Davidtowleii, Today, 12:15 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post Davidtowleii  
                      Working...
                      X