NexusFi: Find Your Edge


Home Menu

 





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 TRADEFORPIECE with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,674 views
    2. thumb_up 6 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

Some Basic NinjaTrader Coding Questions -- IDataSeries

  #1 (permalink)
 Crow 
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
Posts: 52 since Apr 2010
Thanks Given: 20
Thanks Received: 19

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

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
11 thanks
HumbleTraders next chapter
11 thanks
  #3 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


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
Thanked by:
  #4 (permalink)
 Crow 
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
Posts: 52 since Apr 2010
Thanks Given: 20
Thanks Received: 19


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
  #5 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


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
  #6 (permalink)
 Crow 
Las Vegas, Nevada
 
Experience: None
Platform: MultiCharts
Posts: 52 since Apr 2010
Thanks Given: 20
Thanks Received: 19

Thanks bukkan, appreciate.

Started this thread Reply With Quote
  #7 (permalink)
 samWest 
Houston, Texas
 
Experience: Advanced
Platform: NinjaTrader
Posts: 25 since Oct 2010
Thanks Given: 2
Thanks Received: 19

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
Thanked by:
  #8 (permalink)
TRADEFORPIECE
Tampa Florida
 
Posts: 1 since Jun 2017
Thanks Given: 0
Thanks Received: 0

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




Last Updated on October 15, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts