NinjaTrader Support Forum  

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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-23-2012, 03:18 PM   #1
Spiderbird
Member
 
Join Date: Apr 2012
Posts: 67
Thanks: 27
Thanked 8 times in 7 posts
Default Arrays or DataSeries for storing sequences?

Hi all,

I'm trying to decide what type of list method I should use to store patterns of volume/MFI sequences I'm seeing on an equity chart. I'm leaning more towards ArrayLists, but I'd like some perspective.

Here's what I'm attempting to do.

As the market moves through the day on a one minute chart, I'm having my strategy look for volume and MFI (Money Flow Index) patterns. Right now, whenever a one-minute volume bar goes over the 14 period moving average by more than 2 (i.e. the moving average of an example one minute bar is 50000, and volume is 115000), it registers a hit and increments a value.

What I'm thinking about doing is storing these patterns in a multi-dimensional array list and triggering buy/sell orders based on those patterns. So it would work something like this:

Start:

2x volume hit (Set the first value of the array to '2x')
Evaluate arraylist for pattern. If no pattern, no action.

3x volume hit (Set the second value of the array to '3x')
Evaluate.. If no pattern, no action and continue.

MFI hit (Set the third value of the array to 'MFI')
Evaluate. Pattern matches, and order executes.
Array either resets all stored values, or moves do a different dimension (Array[1][0]) to store a new pattern.

....

Rinse and repeat.

Make sense? I'd probably also add a date/time stamp to see when the pattern occurred if I were to store the dimensions in the array.

My biggest question is.. would a dataseries object be more appropriate for this?

Thanks in advance to any responses.

Yours,
Spider
Spiderbird is offline  
Reply With Quote
Old 07-23-2012, 03:24 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,770
Thanks: 158
Thanked 562 times in 553 posts
Default

Unfortunately we would not be able to assist with creating an ArrayList, but it would be possible to use with custom C# programming.

I see no reason you wouldn't be able to accomplish this with using a supported DataSeries object.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-23-2012, 03:35 PM   #3
Spiderbird
Member
 
Join Date: Apr 2012
Posts: 67
Thanks: 27
Thanked 8 times in 7 posts
Default

I'm not asking for anyone to code it . I'm planning on doing that.
I'm just wondering if arraylists or dataseries objects are a better direction to go in.

The one question I'm trying to answer is... can dataseries and/or arraylists be evaluated by looking for sequences? Meaning, can I search a dataseries by "3x", "2x", "2x", in that order?
Spiderbird is offline  
Reply With Quote
Old 07-24-2012, 07:02 AM   #4
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,770
Thanks: 158
Thanked 562 times in 553 posts
Default

Hello,

A data series would only be able to hold one value for every bar on the chart. If you are looking to store more information per bar, you would need to use an Array or Array list.
NinjaTrader_Matthew is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Matthew for this post:
Old 07-24-2012, 07:18 PM   #5
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,199
Thanks: 24
Thanked 1,225 times in 996 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by Spiderbird View Post
I'm not asking for anyone to code it . I'm planning on doing that.
I'm just wondering if arraylists or dataseries objects are a better direction to go in.

The one question I'm trying to answer is... can dataseries and/or arraylists be evaluated by looking for sequences? Meaning, can I search a dataseries by "3x", "2x", "2x", in that order?
Sounds like you need to use structs to hold your related values, and ArrayLists to hold your structs.
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 07-25-2012, 03:20 PM   #6
Spiderbird
Member
 
Join Date: Apr 2012
Posts: 67
Thanks: 27
Thanked 8 times in 7 posts
Default

Thanks for the suggestions Koganam and Matthew! I'm all set over here and coding away. Appreciate the time.
Spiderbird is offline  
Reply With Quote
Reply

Tags
arraylist, dataseries, mfi, sequence, volume

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
DataSeries verses Array: Processing and storing non-sequential data tonyh Indicator Development 0 10-25-2011 08:00 AM
Arrays of DataSeries DLatNT Indicator Development 3 10-10-2011 11:08 AM
Help with Arrays not DataSeries Compiles won't run Crassius Indicator Development 4 02-25-2011 03:38 PM
Calculating and storing in DataSeries Skeletor Strategy Development 2 06-20-2010 01:50 AM
Using Arrays LloydH Automated Trading 4 03-17-2010 06:05 AM


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