I tried using Indicators[0].High[0] from within my indicator and that seemed to work but I don't think that is a stable solution. Is there a better way to do this? Thanks in advance!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
accessing OHLC price data from an indicator
Collapse
X
-
accessing OHLC price data from an indicator
I would like to access OHLC price data from my indicator when the indicator takes an input series other than price data. For instance, if i'm developing an indicator and use OBV() as the input series, then when I call Open[0], High[0], Close[0] etc... from within my indicator, I will receive data from the OBV() input series. In this situation what can I use to access the OHLC of the actual price data?
I tried using Indicators[0].High[0] from within my indicator and that seemed to work but I don't think that is a stable solution. Is there a better way to do this? Thanks in advance! -
That would be correct. Those Array structures are always internally created by NT, and so are accessible. However, know that you are probably in unsupported territory.Originally posted by tcon1111 View PostI would like to access OHLC price data from my indicator when the indicator takes an input series other than price data. For instance, if i'm developing an indicator and use OBV() as the input series, then when I call Open[0], High[0], Close[0] etc... from within my indicator, I will receive data from the OBV() input series. In this situation what can I use to access the OHLC of the actual price data?
I tried using Indicators[0].High[0] from within my indicator and that seemed to work but I don't think that is a stable solution. Is there a better way to do this? Thanks in advance!
Comment
-
Example
Hello Cal,
Thanks for the quick reply. For instance, if you create a new indicator with this line of code in the OnBarUpdate():
Print("High[0]: " + String.Format("{0:0.00}", High[0]) + "; Indicators[0].High[0]: " + String.Format("{0:0.00}", Indicators[0].High[0]));
Then choose said indicator to be displayed on a chart with OBV() selected for the Data / Input Series option in the parameter dialog, you will see something like this in the output window:
High[0]: -143.00; Indicators[0].High[0]: 1112.40
The key is to choose OBV() as the input series to the indicator you created. In this situation the "High[0]: -143.00" on the left is the OBV data which was obtained using High[0] and the "Indicators[0].High[0]: 1112.40" is the price data obtained using Indicators[0].High[0].
More specifically, I'm trying to create an indicator that can take any dataseries as input and be able to make comparisons with price data in the underlying chart. I need a good way to always be able to access price data no matter the chosen input series. As I'm aware of now, outside of the Indicators[0] trick, price data can only be accessed if it is also the indicator's input.
Comment
-
Yes, I've had a few crashes using this technique, so I was hoping there was a more stable way to do it.Originally posted by koganam View PostThat would be correct. Those Array structures are always internally created by NT, and so are accessible. However, know that you are probably in unsupported territory.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
576 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment