Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.Kate W.NinjaTrader Customer Service
-
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
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.Kate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
601 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
16 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
||
Started by agclub, 04-21-2024, 08:57 PM
|
3 responses
17 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:42 PM
|
Comment