• 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

AddBar Question

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

    AddBar Question

    Hi,

    When creating a custom bar type, in the OnDataPoint() method when AddBar() is used, it seems that the arguments in the call to the AddBar method are rounded to the nearest instrument tick size when the bar is added. Is this correct? If yes, is there a way to simply add just the raw data rather than have the raw data rounded off to the nearest instrument tick size?

    #2
    Hello Zeos6,

    Thank you for the post.

    I dont believe there would be an easy way around this except to change the instruments master tick size. The rounding you are seeing would be expected, all BarsTypes are rounded to the Instrument tick size that's defined. As far as I am aware, that would be the only correct way or to change the tick size.

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

    Comment


      #3
      Hi Jesse,

      Thank you for your reply. So what I am trying to do is essentially paint my own BarSeries. I want to take in the streaming data, process the data and paint bars based on the processed data. I am thinking that AddBar() is a wrapper that filters the argument data and passes the results to a paint factory of some sort.

      I did not think of the possibility of changing the master instrument tick size. Two questions:

      1. How would I do this?
      2. Can this change be done so that it only affects a single chart and leaves the other charts of the same instrument unaffected?

      Comment


        #4
        Hello Zeos6,

        Thank you for the post.

        If you need something other than the tick size, this would be a good use case for an indicator that is not bound to a specific TickSize.

        The BarsType will use the TickSize for the instrument being used. I dont believe there is any way to use the BarsType in the way you want without adjusting the overall tick size.

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

        Comment


          #5
          Hi Jesse,

          I am not sure what you are saying here. Is there any way to paint the bar series without having tick size restrictions? Are saying I need to build an indicator to paint the bars?

          Comment


            #6
            Hello Zeos6,

            No there is not, the chart renders based on the instruments/series being used and TickSize is a big part of how that all works.

            What I had meant is that if the TickSize is going to limit your idea, you would need to use a different type rather than a BarsType. An indicator is not locked to the TickSize so perhaps that could be used for your ideas. This would be something you could investigate as it is not clear what your overall goal is aside from trying to use a BarsType.

            Alternatively, you would need to change the instruments tick size in the instrument manager so the bars can be built with a different granularity for the values displayed. If you have data with a granularity of 0.00001 but have a tick size of 0.01, you will lose the difference in granularity when the bars are built due to the settings for the Instrument being used.

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

            Comment


              #7
              Hi Jesse,

              Basically I am trying to paint my own custom bars, and to paint them tick size is irrelevant. For example, the ES futures contract has a tick size of 0.25. That means that all bar ranges for ES will be integer multiples of 0.25. But lets say I want to build an ES bar that has a range of say 1.1 points. This is a range of 4.4 ticks. How would I do that?

              Comment


                #8
                Hello Zeos6,

                To make bars that end in .1, you would need a ticksize that includes 0.1. The bars can break however your logic determines but the prices that are shown are segmented based on the TickSize. You can experiment with this by changing an instruments tick size, and then import your data and view a chart. For example if I changed the ES from 0.25 to 0.1, the prices on the chart would look like the following image:
                https://lh3.googleusercontent.com/-A...0_15-44-42.png



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

                Comment


                  #9
                  Hi Jesse,

                  Thank you for the reply. Ok. I do not mind the axis looking like that. I can adjust the axis properties to get the look I want. And then I can use the logic in AddBars() to create my own range, right? I will give that a try and see how that works. By the way, if you have any code snippet that might achieve what I am after I'd really appreciate it. Thank you for your suggestions and your help..

                  As an aside, it would be really nice to give us the ability to paint our own bars without the tick size restriction. A number of platforms already do that and I don't think it should be that much of an issue if AddBar() is a wrapper of some sort. Just a suggestion.

                  EDIT:
                  As an aside, is there any way I can create a duplicate of an instrument and give it a different name? So using the case above, I'd like to leave ES at the 0.25 tick size but create another version of ES, say I call It ES*, and give the duplicate the 0.1 tick size.
                  Last edited by Zeos6; 04-20-2018, 04:21 PM.

                  Comment


                    #10
                    Hello Zeos6,

                    Thank you for the post.

                    I would suggest looking at how the existing BarsTypes and how they are created if you are interested in learning how to make one. The BarsType is simply for breaking the data into chunks which later can be supplied to the chart or indicators. If you are interested in Ranges, you may look at the Range bar type or Renko for some ideas.

                    Regarding the instrument, you can define custom instruments if you would like using the Instrument manager. You could certainly create a second ES instrument with different settings. The existing instrument can be referenced for the values needed, and then you could modify them as needed.

                    One note is that changing the tick size can prevent trades from being accepted by some brokers, there can also be issues if you try to trade both a custom instrument and the standard instrument using the same symbol map simultaneously. It would be advisable to not use the custom instruments for trading specifically.


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

                    Comment


                      #11
                      Thanks Jesse.
                      Can you please let me know more information about creating a duplicate instrument? How would I go about doing it? Will it get updated same way as the base instrument?

                      Comment


                        #12
                        Hello Zeos6,

                        I would suggest reviewing the help guide section we have on editing Instruments with the instrument manager:
                        https://ninjatrader.com/support/help...nstruments.htm
                        https://ninjatrader.com/support/help...ment%2Bmanager

                        When you open a chart to an instrument or use any tool that selects an instrument you are creating a subscription to that instrument. Assuming you have used valid settings, you should then see the instrument's data and get updates for it.

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

                        Comment


                          #13
                          Thanks Jesse but this is not very helpful to me. I l looked at the material and it seems that each instrument is linked to a data provider. I am still unsure how to add an instrument based off a real instrument.

                          Comment


                            #14
                            Hello Zeos6,

                            Yes, that is correct, each data provider has their own symbol mapping schema which you can see many examples in the existing predefined instruments.

                            If you will be duplicating an instrument, you would need to just copy the settings that you can see in the original instrument into the new instrument including the symbol mapping.

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

                            Comment


                              #15
                              Hi Jesse,

                              So do I just give it my own name in the Master Instrument part of the General tab and replicate the mappings as, for example, in the ES?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by 911C4S, Today, 06:51 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post 911C4S
                              by 911C4S
                               
                              Started by dlanthana, Today, 06:24 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post dlanthana  
                              Started by cupir2, 10-13-2018, 04:39 PM
                              8 responses
                              70 views
                              0 likes
                              Last Post NinjaTrader_JaredM  
                              Started by jg123, Today, 03:34 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post jg123
                              by jg123
                               
                              Started by Zeos6, Today, 02:48 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Zeos6
                              by Zeos6
                               
                              Working...
                              X