NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM 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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-25-2010, 05:45 AM   #1
kiriru
Junior Member
 
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
Cool Dataseries : Static?

Hello,
I am trying to store the opening price into a dataseries and then access it for my entry conditions.
1. Can I use the time function to limit the time a value is stored into my dataseries?
e.g

if((ToTime(Time[0]) >= 160000 && ToTime(Time[0]) < 160030))
{
myDataSeries.Set( Open[0]);
}

2. Does this object store a static value or will it have to update OnBarUpdate?

3. If I use the Reset method to reset the dataseries at a certain time ( say close) will my data series be having a value of 0 or null?

I'm trying to enter the market if the price crosses a certain threshold from open:

if (Close[1] > myDataSeries[1] + trigger * TickSize);
{
EnterLong(Quantity, "Long A");
}
-Kiriru
kiriru is offline  
Reply With Quote
Old 08-25-2010, 06:20 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

Kiriru, yes you can use the Time() to limit setting values for your DataSeries, however I'm not sure why you need to work with a series, wouldn't storing your price value to a double variable do?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-25-2010, 07:00 AM   #3
kiriru
Junior Member
 
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
Default

Bertrand,
Thank you for your quick response.
Is there a reference sample or thread you can recommend.
I can only find this that refers to barsAgo

double sum = 0;
for (int barsAgo = 0; barsAgo < Period; barsAgo++)
{
sum = sum + Input[barsAgo];
}
How can I refer to the Open or close of the FirstBarOfSession?
Thanks again.
Kiriru
kiriru is offline  
Reply With Quote
Old 08-25-2010, 07:07 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
Default

You're welcome - I'm not aware of a specific sample, just save the value to a variable at your desired time then -

Code:
 
if (Bars.FirstBarOfSession)
myOpen = Close[0];
You can also access this value as defined by your session times from the CurrentDayOHL indicator.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-31-2010, 04:45 AM   #5
kiriru
Junior Member
 
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Bertrand,
This was very helpful.
kiriru is offline  
Reply With Quote
Reply

Tags
dataseries, mydataseries

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
Static SuperDom higler Version 7 Beta General Questions & Bug Reports 2 01-29-2010 10:07 AM
Static SuperDOM obulig SuperDOM and other Order Entry Windows 2 12-31-2008 05:07 PM
How to copy DataSeries to another DataSeries xewoox General Programming 8 12-02-2008 07:53 AM
static dome BLanphar Installation and Licensing 18 06-26-2008 03:32 PM
Static SuperDom? eurjpytrader SuperDOM and other Order Entry Windows 4 09-17-2007 11:12 AM


All times are GMT -6. The time now is 11:01 AM.