![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
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?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,414
Thanks: 252
Thanked 977 times in 960 posts
|
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];
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Apr 2010
Location: Tokyo
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Bertrand,
This was very helpful. |
|
|
|
![]() |
| Tags |
| dataseries, mydataseries |
| Thread Tools | |
| Display Modes | |
|
|
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 |