The indicator compiles properly so that part seems OK, The issue I'm having is obtaining these Boolean values in the strategy. Not sure of the exact syntax for getting the values. I've tried Indicator_name.boolseries[1] but no luck. Also should I create the data series objects in the strategy as well? That was already done in the custom indicator. What should be included in the Initialization block for the strategy to pull these values?
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
Retrieving Bool series values created in an indicator into a strategy
Collapse
X
-
Retrieving Bool series values created in an indicator into a strategy
Hello- I've created a custom indicator in which I generate a bool series to determine whether I should buy or sell a stock. This bool series is synchronized to historical data and follows the format shown in the following example code.
The indicator compiles properly so that part seems OK, The issue I'm having is obtaining these Boolean values in the strategy. Not sure of the exact syntax for getting the values. I've tried Indicator_name.boolseries[1] but no luck. Also should I create the data series objects in the strategy as well? That was already done in the custom indicator. What should be included in the Initialization block for the strategy to pull these values?Tags: None
-
Hello ciro1963,
Thanks for your post.
The SampleBoolSeries indicator creates a private BoolSeries which the indicator uses, and a public BoolSeries which is accessible from external scripts. The public Bool Series will return the private BoolSeries.
The BoolSeries can be accessed as a property of an indicator object if you instantiate the indicator, or you could reference the BoolSeries as is done in the example like:
SampleBoolSeries().BullIndication[0]
If you are looking to have this value be more readily accessible like from a Plot so it can be used in the Strategy Wizard, you could create a plot and assign a 1 or 0 to represent true/false instead of using the SeriesBool.
I may also suggest to create simple modifications to the SampleBoolSeries script before implementing in your main scripts to become more familiar with the usage.
Please let us know if you have any additional questions.JimNinjaTrader Customer Service
-
The SampleBoolSeries() constructor has zero arguments, however mine has three since I need to pass in several numbers from the strategy to the indicator. My syntax is of the form IndicatorName(1,1,1) . However I'm getting a "Indicator.IndicatorName.buymkt1 is inaccessible due to its protection level" error message. I'm not sure why I'm getting this error. I'm following the same format as shown in the SampleBoolSeries indicator and strategy. Any idea of what could be happening?
Comment
-
I just figured it out! It's a syntax issue. I must use a capital "B" in the IndicatorName(1,1.2,1).Buymkt1[0] statement even though it was declared without a capital letter. Instead I was using IndicatorName(1,1.2,1).buymkt1[0]. I guess it has to be upper case because that's how it it referred to in the "Public" statement.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Waxavi, Today, 02:10 AM
|
1 response
16 views
0 likes
|
Last Post Today, 03:03 PM | ||
Started by Kaledus, Today, 01:29 PM
|
5 responses
13 views
0 likes
|
Last Post Today, 02:56 PM | ||
Started by Waxavi, Today, 02:00 AM
|
1 response
12 views
0 likes
|
Last Post Today, 02:53 PM | ||
Started by alifarahani, Today, 09:40 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 02:53 PM | ||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
3 responses
17 views
0 likes
|
Last Post Today, 02:41 PM |
Comment