• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Retrieving Bool series values created in an indicator into a strategy

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    https://ninjatrader.com/support/foru...-are-not-plots

    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?

    #2
    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

    Comment


      #3
      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


        #4
        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 ralett, Today, 11:44 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Spencer  
        Started by DMDINAZ, Today, 11:03 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by sukhob, Today, 10:14 AM
        4 responses
        10 views
        0 likes
        Last Post sukhob
        by sukhob
         
        Started by beaacontreras, Today, 09:27 AM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by fxSol, 03-17-2019, 04:17 AM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Working...
        X