Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Input and Value
Collapse
X
-
Input and Value
The Value[0] and Input[0] are used in the SMA indicator. What is the Input[0] here? Is it the Close of that bar? Is the Value[0] the return value for SMA? Also, there is no Series declared in the SMA indicator. How does the previous SMA values are stored? If it is stored in Values, does that means other indicators can not use Values any more? Thanks!Tags: None
-
Hello atrader,
Thank you for your post.
Value[0] would be the plot, so assigning some value to that would be assigning a value to the plot for the currently processing bar. This stores the SMA values.
Input[0] simply means use whatever data series is specified. The SMA can use a price series, or an indicator plot to calculate, so that's why you don't see "Close[0]" or another price series specified.
Please let us know if we may be of further assistance to you.
-
Hello Kate,
Thank you so much for the response. I am trying to create a series of data associate with each bar, just like the High, Low, Open, Close. But I could not find the code for those, such as High. Can you provide a link with that information or give some sample codes? or I have to use Indicators to develop this? I do not need to show them on chart. That is why I am thinking something like High, Low might be more close to what I need?
Thank you again!
Comment
-
Hello atrader,
Thank you for your reply.
It sounds like a custom Series<t> is what you're looking for. A custom series is basically just a variable with slots for each bar in the data series. Price series like High, Low, Open and Close are a series that automatically is filled for you, but you can make a custom series to store whatever you like on each bar.
For example, I could instantiate my series at the class level, set it up in State.DataLoaded, and then assign
A more full fledged example is available in our help guide here:Code:// instantiate a series to hold double values private Series<double> MySeries; //in OnStateChange else if (State == State.DataLoaded) { MySeries = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix); } // in OnBarUpdate // assign a value for the current bar MySeries[0] = High[0] + Low[0] / 2; // we can refer to prior values in the Series using bars ago values if (MySeries[0] > MySeries[1]) { // do something }
Please let us know if we may be of further assistance to you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment