thanks
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
existing indicator?
Collapse
X
-
existing indicator?
Hello. I'm wondering if you guys are aware of any existing indicators I can use for calculating market beta for an instrument? even if there are only subcomponents available, eg. variance or covariance that would be a start. if not I can build them relatively easily but figure i'd just check first.
thanksTags: None
-
Hello stewarco,
Thanks for your post.
There does appear to be an existing NinjaTrader 7 indicator that accomplishes this task. The NinjaTrader 8 Code Breaking Changes page of the help guide could be referenced when converting this indicator to NinjaTrader 8.
NT7 Beta indicator - https://ninjatrader.com/support/foru...tid=-1&lpage=1
Code Breaking Changes - https://ninjatrader.com/support/help...ng_changes.htm
Please let us know if there is anything else we can do to help.JimNinjaTrader Customer Service
-
a few questions
Hi. So I decided to go ahead and build my own indicator.
1) Does this indicator get updated on every bar update, regardless of whether I call it or not?
2) Are the values then forthwith associated with that same bar? eg. what is now Indicator[0] becomes Indicator[10] 10 bars later?
3) If I have created a series within that indicator, are those values also linked to a specific bar going forward, or do I need to redefine the series every time I call it?
4) In the body of the indicator, where do I actually specifiy the value that is being returned? Eg., my indicator is called Covariance, and I have a variable covariance that is equal to the value I want, but it's unclear to me how I associate that with the actual value that is returned from my indicator when I call it.
5) Is there a place in my strategy code where I need to let the strategy know that a given indicator is going to be used prior to me calling it?
Thanks
Comment
-
Hello stewarco,
Thanks for your additional questions.
1) Does this indicator get updated on every bar update, regardless of whether I call it or not?
2) Are the values then forthwith associated with that same bar? eg. what is now Indicator[0] becomes Indicator[10] 10 bars later?
3) If I have created a series within that indicator, are those values also linked to a specific bar going forward, or do I need to redefine the series every time I call it?
4) In the body of the indicator, where do I actually specifiy the value that is being returned? Eg., my indicator is called Covariance, and I have a variable covariance that is equal to the value I want, but it's unclear to me how I associate that with the actual value that is returned from my indicator when I call it.
5) Is there a place in my strategy code where I need to let the strategy know that a given indicator is going to be used prior to me calling it?
I would recommend using the Strategy Builder to get more acquainted with syntax for adding indicators to strategies and using strategies all together. Our open source indicators can also be referenced for how an indicator plots data.
Documentation items that can be referenced for further reading as well as a link to the Strategy Builder 301 tutorial are linked below.
Strategy Builder 301 - https://ninjatrader.com/Webinar/Strategy-Builder-301
Series<t> - https://ninjatrader.com/support/help...us/seriest.htm
AddPlot() - https://ninjatrader.com/support/help...us/addplot.htm
Value - https://ninjatrader.com/support/help...n-us/value.htm
Values - https://ninjatrader.com/support/help...-us/values.htm
We look forward to being of any further assistance.JimNinjaTrader Customer Service
Comment
-
one more thing
ok. two more questions:
1) so I see that you say Indicator return Values. does that mean if the quantity I ultimately want to return is called x, then at some point in the indicator I would make an assignment statement Value = x?
2) A related question, I guess: since I don't really need to show these on a chart, but instead am just looking for a function I can use to in a variety of strategies to return the value of a relatively complex calculation, is there a better way for me to accomplish this (as opposed to simply copying the block of code and inserting it in each strategy)?
Thanks
Comment
-
Hello stewarco,
Happy to answer.
1) so I see that you say Indicator return Values. does that mean if the quantity I ultimately want to return is called x, then at some point in the indicator I would make an assignment statement Value = x?
2) A related question, I guess: since I don't really need to show these on a chart, but instead am just looking for a function I can use to in a variety of strategies to return the value of a relatively complex calculation, is there a better way for me to accomplish this (as opposed to simply copying the block of code and inserting it in each strategy)?
AddChartIndicator() - https://ninjatrader.com/support/help...tindicator.htm
If there is anything else that you come across that isn't clear, please don't hesitate to ask.JimNinjaTrader Customer Service
Comment
-
hi
ok thanks. So it sounds like the AddPlot methodology is the way to go regardless of whether I ever plan to look at it on a chart or not.
I haven't done that yet, and currently I have strange problem that while the "main code"might be on bar 100, as soon as i'm within the indicator code it is telling me I'm on bar number (-1) so I keep getting out of range errors. Any idea why this would happen? I'll try doing the AddPlot for now and see what happens.
Comment
-
Hello stewarco,
Debugging steps will need to be taken to better understand the error received and how it should be corrected. I've included some resources on debugging tips and some referencing errors in this post.
It may prove useful to first create the indicator framework for adding a plot and then assigning the plot's Value with Close[0] before proceeding with your port. This way you can approach the conversion of the indicator separately from the creating the underlying framework.
Debugging tips - https://ninjatrader.com/support/help...script_cod.htm
Index out of range errors (specifically for making sure there are enough bars for your calculations.) - https://ninjatrader.com/support/help...nough_bars.htm
As a more direct tip, adding prints throughout the code will point to where you see the error and it should then be possible to understand how to fix it.
Please let us know if you have any questions on these materials.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by TheTradingMantis, 10-31-2017, 03:18 PM
|
5 responses
1,251 views
0 likes
|
Last Post
by TheAngryCube
Today, 04:06 PM
|
||
Started by Padan, Today, 02:02 AM
|
9 responses
23 views
0 likes
|
Last Post Today, 03:27 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
7 responses
22 views
0 likes
|
Last Post Today, 03:26 PM | ||
Started by nandhumca, Today, 03:15 PM
|
1 response
4 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
Comment