Some Basic NinjaTrader Coding Questions -- IDataSeries - futures io
futures io futures trading



Some Basic NinjaTrader Coding Questions -- IDataSeries


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Crow with 3 posts (0 thanks)
    2. looks_two bukkan with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 samWest with 1 posts (4 thanks)
    1. trending_up 5,841 views
    2. thumb_up 6 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Some Basic NinjaTrader Coding Questions -- IDataSeries

(login for full post details)
  #1 (permalink)
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
 
Posts: 51 since Apr 2010
Thanks: 19 given, 19 received

I am trying to convert the reverse-engineered JMA indicator found in the MAMulticolored zip under the download section to run on my Java-based platform. Most of the conversion is straight-forward, but I don't know how to handle the following buffers:

JMAValueBuffer = new DataSeries(this);
fC0Buffer = new DataSeries(this);
fA8Buffer = new DataSeries(this);
fC8Buffer = new DataSeries(this);

I either need to implement a DataSeries class which behaves the same as Ninja's DataSeries class, at least to the extent required by the indicator, or i need to remove the data series and use something else. The problem is that I can't find any API for DataSeries. Closest I found is here:

NinjaTrader Version 7

So maybe someone here can help me out with a few questions:

1.
series = Input[0];

What is Input[0]? Is that the most recent input in the buffer corresponding to the right-most datapoint on the chart or is that the left-most datapoint?

2.
fC0Buffer.Set(series);

Series is a double. What is set in the buffer? Does the line above simply append the series value to the end of the data series array or does it push the value onto the front (pushing all previous elements in the array back by 1 index)?

3.
If OnBarUpdate() is called on each bar update event (incoming tick), what does Input DataSeries contain? It seems that if Input contained all data received so far, the entire indicator would be recomputed for every input value on each update, which would be very inefficient.

Started this thread Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(170 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(116 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 269 received


Input = input series is the one you select from the parameter dialog box. it can be close open high low median etc. input[0] is the most recent value (a double) of the series.

a value is set to the dataseries. this is the recent most value. there is a overload too where you can define the "recent most". like buffer.Set(1,series) here 1 represent the previous bar.

Input is a series. when you compute, the whole series dont get recalculated. normally only the most recent data point gets calculated (unless you want to recalculate the past data points too).

Reply With Quote
The following 2 users say Thank You to bukkan for this post:
 
(login for full post details)
  #4 (permalink)
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
 
Posts: 51 since Apr 2010
Thanks: 19 given, 19 received


bukkan View Post
Input = input series is the one you select from the parameter dialog box. it can be close open high low median etc. input[0] is the most recent value (a double) of the series.

a value is set to the dataseries. this is the recent most value. there is a overload too where you can define the "recent most". like buffer.Set(1,series) here 1 represent the previous bar.

Input is a series. when you compute, the whole series dont get recalculated. normally only the most recent data point gets calculated (unless you want to recalculate the past data points too).

But when a value is set to the dataseries -- does it replace the value at index 0 or simply push back all entries by 1 and then set the 0 index to the new value?

So when backfilling, onBarUpdate is called for each bar in the series? Whenever new input data is pushed onto the DataSeries, it's called?

Is the IDataSeries interface posted somewhere? The purpose of an interface is to tell users what calls are available for calling. Not sure why IDataSeries interface is so hard to find.

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 269 received


Crow View Post
But when a value is set to the dataseries -- does it replace the value at index 0 or simply push back all entries by 1 and then set the 0 index to the new value?

it replaces. it pushes back all entries by 1 only when a new bar/candle is formed.


Crow View Post
So when backfilling, onBarUpdate is called for each bar in the series? Whenever new input data is pushed onto the DataSeries, it's called?

it reads all the historical bars. but when live it dosent reads the historical bars unless asked to do.


Crow View Post
Is the IDataSeries interface posted somewhere? The purpose of an interface is to tell users what calls are available for calling. Not sure why IDataSeries interface is so hard to find.

didnt get you, but you can use reflector.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
 
Posts: 51 since Apr 2010
Thanks: 19 given, 19 received

Thanks bukkan, appreciate.

Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
Houston, Texas
 
Experience: Advanced
Platform: NinjaTrader
 
Posts: 25 since Oct 2010
Thanks: 2 given, 19 received

DataSeries is a slight misnomer. A better name would have been DoubleSeries in keeping with the other XXSeries names such as BoolSeries, IntSeries, FloatSeries and StringSeries. I found this confusing at first.

These XXSeries classes are basically container classes that maintain an index synchronization that is aligned with the indexing scheme that is used to access data. Think of the "this" parameter that is passed into the DataSeries constructor as saying "Keep this double countainer's index syncronized with "this" indicators data index."

Ninatrader and Tradestation and I assume many other chart scripting languages use an indexing scheme where the rightmost bar (the last one created) is always index 0. And the second to the rightmost (one bar to the left) is index 1, etc. Close[0] gives the closing price of the rightmost bar, Close[1] is the closing price for the bar to it's left.

If you are familiar with "normal" container classes, when you add an item to say a List<>, the size of the list increases by one, and the last added item is accessed by "[Count-1]". Behind the scene I'm sure DataSeries is doing this, but to make it easier (a scripting language) some type of re-indexing or an offset calculation is probably being done in an override of the indexer ( [ ] ).

Since the DataSeries container is synchronized with this indexing scheme, DataSeries data is accessed exactly the same way - index 0 is the DataSeries value assiciated with the data at index 0. Since only one value can be stored at that index location, If you keep calling Set, it will just keep overwriting the data at that index.

Reply With Quote
The following 4 users say Thank You to samWest for this post:
 
(login for full post details)
  #8 (permalink)
Tampa Florida
 
 
Posts: 1 since Jun 2017
Thanks: 0 given, 0 received

NinjaTrader 7 Help

I am attempting to utilize 2 DataSeries to compare my current candles Low to the low of a specific time
of day. If the current candles low does indeed show that it is lower, then i check to see if the candle
close is less than the lower Bollinger band. I am confused with how to look back at a particular time within the second array to get the low of the particular set time i have stored. Can anyone help?

In one array i am setting the low of say Time 3:01 and the array length is one since it only needs to keep one Value. The other DataSeries would keep multiple values and check against the shorter
array. As time advances i will check back to 301 again and again until it is time to reset 301 for the next day.

private DataSeries[]EntryLow; // Short Array
private DataSeries myDataSeries; // Long Array

#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>

protected override void Initialize()
{
EntryLow = new DataSeries[1];// Array Size
//EntryLow = new DataSeries(this);

myDataSeries = new DataSeries(this, MaximumBarsLookBack.Infinite);

CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>

protected override void OnBarUpdate()
{

myDataSeries.Set(Low[0]);


if(ToTime(Time[0]) == ToTime(3,01,0))
{
EntryLow.Set(Low[0]);
}

if(ToTime(Time[0]) > ToTime(3,01,0)
&& myDataSeries[0] < EntryLow //Not sure how to call EntryLow stored value
&& Low[0] < Bollinger(2, 14).Lower[0])
{
DrawHorizontalLine("My horizontal line" + CurrentBar, 5, Color.Chartreuse);
}
}

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Some Basic NinjaTrader Coding Questions -- IDataSeries


Last Updated on October 15, 2017


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts