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
What is Input ?
Collapse
X
-
Hello,
Input is the collection of Input IDataSeries a item has.
To ensure I am referring to the same as you are, this is the Input I am describing: http://www.ninjatrader.com/support/h.../nt7/input.htm
An example of this is the SMA(IDataSeries, Period)
The IDataSeries could be Close prices for example, so we have :
Code:double someValue = SMA(Close, 12)[0];
Code:Value.Set(Input[0]);
also
Code:Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period)); else Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Originally posted by NinjaTrader_Jesse View PostAn example of this is the SMA(IDataSeries, Period)
The IDataSeries could be Close prices for example, so we have :
Code:double someValue = SMA(Close, 12)[0];
Code:Value.Set(Input[0]);
Code:double someValue = SMA(Close, 12)[1];
Code:Value.Set(Input[1]);
Originally posted by NinjaTrader_Jesse View PostThis line says to Set the CurrentBar's value from Input or Input[0]. Value is the generic name for the index 0 Plot of this indicator.
Comment
-
Hello,
The Input and Input[0] are a Collection and an Index location of that collection.
Input represents the DataSeries that you gave to the indicator, in the SMA(Close,12) call, we provide the SMA Close prices to use.
In the code for the SMA, Input represents the passed series.
Input[0] would be the amount of BarsAgo to get the price value for. The last bar on the chart is the CurrentBar or 0 bars ago.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello,
The Input and Input[0] are a Collection and an Index location of that collection.
Code:input[0]
[0] - an Index location of that collection/
It is correct?
If I'm right... Input it is Collection of which?
And Input ... is Collection without any index?
Originally posted by NinjaTrader_Jesse View PostInput[0] would be the amount of BarsAgo to get the price value for.
Comment
-
Hello,
Input - Collection.
[0] - an Index location of that collection/
It is correct?
If I'm right... Input it is Collection of which?
And Input ... is Collection without any index?
This is a collection of whatever you provided to the indicator, lets look at the SMA again.
If I call the SMA like the following:
SMA(Close, 12)
I provided the Close DataSeries to the SMA. Inside the SMA it uses Input because it expects a series to be provided to it so it can calculate values. I provided the Close in this example so Input would be Close.
If I instead called SMA(High, 12), input is now the High series.
This does have an index but not like a normal collection. The BarsAgo is used, looking at the statement:
Close[0]
This gets the last index of this collection (bar on the right of the chart or CurrentBar),
the statement:
Close[1]
This would be the the last index of the collection minus 1. It is much easier to think of this in a BarsAgo value instead of a Index location, If i want the Current price I use [0], if I want a previous price i use [1] or [2] etc.. for how many bars ago you need a value from.
Many indicators use Input instead of a specific series like Close because like the SMA you can tell the indicator what values you want it to calculate based off of.
If the SMA was using Close instead of Input, you could only use the SMA for Close prices and that would be all, using Input the SMA can be used to apply a moving average to a number of different items.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello,
You are correct, Input is a collection or to be correct would be a DataSeries.
This is a collection of whatever you provided to the indicator, lets look at the SMA again.
If I call the SMA like the following:
Code:SMA(Close, 12)
If calling indicator like this:
Code:SMA(Low, 12)
But it is not parameter exactly, so elements of dataseries passed to same indicators using interace( IDataSeries ).
innit?Last edited by hozman; 06-17-2015, 10:40 AM.
Comment
-
Hello,
I am sorry but I don't quite understand your question:
In indicator passed element of dataseries - Low.
But it is not parament exactly, so elements of dataseries passed to same indicators using interace( IDataSeries ).
innit?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello,
Input is the collection of Input IDataSeries a item has.
To ensure I am referring to the same as you are, this is the Input I am describing: http://www.ninjatrader.com/support/h.../nt7/input.htm
An example of this is the SMA(IDataSeries, Period)
The IDataSeries could be Close prices for example, so we have :
Code:double someValue = SMA(Close, 12)[0];
Code:Value.Set(Input[0]);
also
Code:Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period)); else Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
I look forward to being of further assistance.
Could you please explain to me what's wrong with this code:
if (CurrentBar == 0)
Value.Set(Input[0]);
else
{
double last = Value[1] * Math.Min(CurrentBar, Period);
if (CurrentBar >= Period)
Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
else
Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
}
If I'm not mistaken this is an original SMA indicator, right?
Comment
-
Hello,
This does look like the SMA code, but I am unsure of what your question is related to this code.
Are you getting an error or is there syntax you do not understand? Can you please put this into the form of a question specific to what is happening or what you are seeing?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello,
This does look like the SMA code, but I am unsure of what your question is related to this code.
Are you getting an error or is there syntax you do not understand? Can you please put this into the form of a question specific to what is happening or what you are seeing?
I look forward to being of further assistance.
Comment
-
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ninza33, Today, 06:46 PM
|
0 responses
1 view
0 likes
|
Last Post
by ninza33
Today, 06:46 PM
|
||
Started by sandman, Today, 06:31 PM
|
0 responses
1 view
0 likes
|
Last Post
by sandman
Today, 06:31 PM
|
||
Started by martini, 03-27-2024, 04:45 PM
|
6 responses
43 views
0 likes
|
Last Post Today, 05:33 PM | ||
Started by bsbisme, Today, 05:06 PM
|
0 responses
5 views
0 likes
|
Last Post
by bsbisme
Today, 05:06 PM
|
||
Started by kezyclaire, 12-01-2023, 09:37 AM
|
4 responses
157 views
0 likes
|
Last Post Today, 04:29 PM |
Comment