Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Some Basic NinjaTrader Coding Questions -- IDataSeries
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:
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.
Can you help answer these questions from other members on NexusFi?
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.
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.
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>