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
No announcement yet.
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.
-
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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment