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
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
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! -
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
-
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 josh18955, 03-25-2023, 11:16 AM
|
6 responses
435 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
3 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
18 views
0 likes
|
Last Post Today, 03:33 PM | ||
Started by frslvr, 04-11-2024, 07:26 AM
|
9 responses
127 views
1 like
|
Last Post
by caryc123
Today, 03:12 PM
|
||
Started by selu72, Today, 02:01 PM
|
1 response
14 views
0 likes
|
Last Post Today, 02:17 PM |
Comment