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

IDataSeries question

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

    IDataSeries question

    I need to have a DataSeries I can write in for each bar, and then for a few entries beyond that. That can be done by calling Set() with a negative index for those extra entries. Experimenting shows that using a DataSeries object for that causes a couple of problems that I associate with over-filling it, though, so it appears that is not a good idea.

    Is there a way to safely over-fill a DataSeries object, or any other object that will hold doubles and that I can pass as input to a moving average indicator?

    If not, is it practical to implement IDataSeries myself? I know -- SMOP -- but I see no real information about IDataSeries so a pointer to some information about it, or to some code examples that implement it, would be helpful.

    Thanks,
    EV

    #2
    Hello EV,

    Use of negative index values for series is unfortunately not supported. Supported use is all positive index values so that you're not able to peak into future values.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello EV,

      Use of negative index values for series is unfortunately not supported. Supported use is all positive index values so that you're not able to peak into future values.
      I understand that, and I already discovered the problems, so just doing it unsupported is not my answer.

      Is there a supported way to have an object that can take the extra values and can also be passed as input to a moving average indicator (which, from what I have read, means it needs to implement IDataSeries)?

      Note that I am not trying to "peek into future values". I am trying to write my own future values.

      --EV

      Comment


        #4
        Data Series are synced to each bar. Unfortunately you can't have more values than there are bars when using data series.

        If you need multiple values per bar, you have to use a different structure. There is an example of using array lists here.
        http://www.ninjatrader-support.com/v...ead.php?t=5790.

        You'd have to code your own moving average logic on these since the system indicators can't read array lists as input.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I am not sure where the idea of multiple values per bar came from. I do not need that -- I need to be able to add extra bars. I'll still have only one value per bar -- it is just that I will have entries in advance of CurrentBar.

          Is there any way to add extra (future) bars to any supported object that can be passed to indicators, such as moving average?

          -- Bob

          Comment


            #6
            No, using negative index values or otherwise setting data series values beyond the current bar is not supported.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Just to be sure I am not misunderstanding anything -- are you saying that there is no class that allows me to have as many values as I want and still pass the class as input to a moving average indicator?

              If that is true, can you point me to enough information that I can implement my own class that supports IDataSeries?

              --EV

              Comment


                #8
                Right - we don't support negative index values with the built in data series structure. Please see here for help with data series.

                You're welcome to program your own structure, but you will not be able to use this as input for anything expecting IDataSeries as input. Unfortunately documentation is not available for creating this structure. Hopefully other community members can offer input in this area.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  A probably-related question:

                  Is there any way to plot anything to the right of the last price bar?

                  For example, if a custom indicator were to displace a moving average to the right, could it make the moving average data all visible, even to the right of the last price bar?

                  --EV

                  Comment


                    #10
                    EV,

                    You can work with displacement to offset the visual placement of an indicator into the future. Displacement can be set through the GUI when adding the indicator or in the indicators Initialize() method. This is only a visual setting for charting.

                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      I am talking about actual plotting the custom indicator is doing from OnBarUpdate(). I am calculating my own function of prices, and I wish to be able to displace into the future the display of a calculation that is based solely on present and past data (i.e. right shift it).

                      I looked at the link and there are several reasons that will not solve the problem. Two of the most obvious are:
                      • The setting involves all plots, and cannot be set per-plot

                      • Even if I get by #1, I don't know what will be needed at Initialize() time. As I have mentioned before (probably ad nauseum) limiting configuration items to Initialize() as the current system does is way, way, way to confining. Let's not re-open that discussion -- there is already a request to change that in a future release.

                      --EV

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by bortz, 11-06-2023, 08:04 AM
                      47 responses
                      1,607 views
                      0 likes
                      Last Post aligator  
                      Started by jaybedreamin, Today, 05:56 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post jaybedreamin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      6 responses
                      19 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by Jon17, Today, 04:33 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post Jon17
                      by Jon17
                       
                      Started by Javierw.ok, Today, 04:12 PM
                      0 responses
                      16 views
                      0 likes
                      Last Post Javierw.ok  
                      Working...
                      X