NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 08-10-2011, 01:21 PM   #1
Light
Member
 
Join Date: Jan 2010
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Default 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.
Light is offline  
Reply With Quote
Old 08-10-2011, 01:46 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

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.
NinjaTrader_Brett is offline  
Reply With Quote
Old 08-10-2011, 02:35 PM   #3
Light
Member
 
Join Date: Jan 2010
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Default 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!
Light is offline  
Reply With Quote
Old 08-10-2011, 02:46 PM   #4
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

This would be unfortunately unsupported if it was possible.

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Old 08-10-2011, 03:07 PM   #5
Light
Member
 
Join Date: Jan 2010
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Default 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.
Light is offline  
Reply With Quote
Old 08-10-2011, 04:32 PM   #6
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,221
Thanks: 24
Thanked 1,233 times in 1,004 posts
Send a message via Skype™ to koganam
Default

Quote:
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.
koganam is online now  
Reply With Quote
The following user says thank you to koganam for this post:
Old 08-11-2011, 09:39 PM   #7
Light
Member
 
Join Date: Jan 2010
Posts: 66
Thanks: 0
Thanked 0 times in 0 posts
Default 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:

http://www.ninjatrader.com/support/f...200#post250200

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

Thanks again for your comments!
Light is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using other values instead of iDataSeries in an indicator mariomaltezi General Programming 2 04-02-2011 04:31 PM
changing periodicity values Eklavya Charting 1 06-17-2010 11:25 AM
changing values for Fib, extensions tomek001 Charting 2 08-29-2009 11:41 AM
Changing historical bar values, Median? heech General Programming 3 12-08-2008 01:43 PM
Changing Values of running strategy mjuviler Strategy Development 2 09-13-2008 04:09 AM


All times are GMT -6. The time now is 02:06 AM.