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

Changing IDataSeries values

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

    Changing IDataSeries values

    Guys, I'd like to change the values of an IDataSeries object so I can pass amended bar Close values into NT indicators as I choose. The idea is to create an IDataSeries based on a secondary set of bars, something like IDataSeries MySeries = Closes[1]; then alter the most recent value of MySeries, and then use MySeries in an indicator to make calculations based on the amended Close. Is this possible? That is, is there a way to reset a single IDataSeries value (something like "MySeries.Set(0,MyValue)")?

    Thanks for your help.

    #2
    Hello,

    Thanks for the forum post.

    When you say iDataSeries do you mean you want to change the Close[0] price for example.

    Or is this your own data series you created?

    I look forward to assisting you further.

    Comment


      #3
      Change Closes[1][0]

      Thanks Brett. Yes -- basically, I'd like to change Closes[1][0] to a new value, then change it back to its original value (on historical bars). I was speculating that that could be done via a new IDataSeries object -- copy historical bar close values to the new IDataSeries but include my choice for the last bar (Closes[1][0]). But the actual goal is to change Closes[1][0], recalculate indicators using the new value, then change it back. Is there a way to do that?

      Thanks again for your help!

      Comment


        #4
        Hello,

        This would be unfortunately unsupported if it was possible.

        Let me know if I can be of further assistance.

        Comment


          #5
          Amend IDataSeries?

          Thanks Brett. So is there a supported way to create an IDataSeries and give it values of my choice? Or to change any of it's values individually?

          If not, then there is no (supported) way to input an amended series into NT indicators for calculation. Is that correct?

          Thanks again for your help.

          Comment


            #6
            Originally posted by Light View Post
            Thanks Brett. So is there a supported way to create an IDataSeries and give it values of my choice? Or to change any of it's values individually?

            If not, then there is no (supported) way to input an amended series into NT indicators for calculation. Is that correct?

            Thanks again for your help.
            Your first post already shows the correct syntax to set values in a DataSeries:

            MySeries.Set(0, MyValue);

            You just need to expose the DataSeries itself as public, and then you can call it from any other indicator and use its values for calculations.

            The idea of changing values of the primary price series itself is probably questionable at best, and fortunately, there really is no need to do so. Just copy the values into another DataSeries that you declare, and manipulate and massage the data any which way you please.

            Comment


              #7
              Requires assigning DataSeries to Secondary Bars

              Thanks koganam. The problem can indeed be solved using a dataseries, but it requires assigning the dataseries to a secondary bar series, as opposed to the primary bar array. The technique for doing that is discussed here:



              With that ability, the secondary Close values can be adjusted and used in any NT indicator, as required.

              Thanks again for your comments!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by frslvr, 04-11-2024, 07:26 AM
              6 responses
              105 views
              1 like
              Last Post NinjaTrader_BrandonH  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              6 responses
              26 views
              0 likes
              Last Post trilliantrader  
              Started by arvidvanstaey, Yesterday, 02:19 PM
              5 responses
              14 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Rapine Heihei, Yesterday, 08:25 PM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Mongo, Yesterday, 11:05 AM
              6 responses
              27 views
              0 likes
              Last Post Mongo
              by Mongo
               
              Working...
              X