• 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

Check for number of data series added to strategy

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

    Check for number of data series added to strategy

    How do I get the number of data series attached to a strategy?

    Essentially, I have a master template strategy that I am using as an abstract base for all my other strategies.

    In my master template I have the following logic below which works great for when the strategy only has one data series, but not when it has more than one. I know I need to use the "BarsSinceEntryExecution(int barsInProgressIndex, string signalName, int entryExecutionsAgo)" when working with multi-time frame and instrument strategies.

    I want to be able to distinguish when to use override and when not to in my code.

    PHP Code:
    [public bool CanEnterBar()
            {
                
                return (
    BarsSinceEntryExecution() >= || BarsSinceEntryExecution() == -1) ? true false;    
            }

            public 
    bool CanExitBar()
            {
        
                return (
    BarsSinceExitExecution() >= || BarsSinceExitExecution() == -1) ? true false;
            } 

    #2
    In addition, I don't understand why in the overload for multi-time frame or instruments you are requiring the "string signalName". It isn't' required for the regular method because there is is an overload where you can supply it. You should create an overload for the multi-time frame or instruments that does not require a signal name.

    Comment


      #3
      Hello cutzpr,

      Thanks for your post.

      You may use BarsArray.Length to get the number of data series, including the primary, that are attached to a NinjaScript. Please note that dynamically adding a data series based on user input, or based on the objects that are not guaranteed to be available in State.Configure is not supported. See AddDataSeries() documentation for more details.

      BarsArray - https://ninjatrader.com/support/help.../barsarray.htm
      AddDataSeries() - https://ninjatrader.com/support/help...dataseries.htm

      I want to be able to distinguish when to use override and when not to in my code.
      Override would be used to override an existing virtual function. In the context of NinjaScript, you may rely on the code generation wizards for methods that would be overridden.

      In addition, I don't understand why in the overload for multi-time frame or instruments you are requiring the "string signalName". It isn't' required for the regular method because there is is an overload where you can supply it. You should create an overload for the multi-time frame or instruments that does not require a signal name.
      The Multi Time Frame overloads contain all the necessary parameters since they are the most "advanced" You may simply pass "" or String.Empty to ignore entry signal binding. Nonetheless, I have submitted your suggestion as a feature request for more Multi Time Frame overloads with less parameters. The ticket ID is: SFT-3521.

      We cannot offer an ETA or promise of fulfillment, but we are tracking interest and the ticket ID number will be noted in the help guide when a new build gets released with the feature implemented.

      Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

      Please let us know if there is anything else we can do to help.
      JimNinjaTrader Customer Service

      Comment


        #4
        The Multi Time Frame overloads contain all the necessary parameters since they are the most "advanced" You may simply pass "" or String.Empty to ignore entry signal binding.
        Thank you very much Jim. I know feature requests take some time if they are ever implemented. May I suggest just adding the above text to the NT8 help guide.

        Comment


          #5
          Thanks for the suggestion cutzpr,

          We do have this in the help guide currently alongside the "fromEntrySignal" parameter description in Managed Approach Exit methods.

          The entry signal name. This ties the exit to the entry and exits the position quantity represented by the actual entry.

          Note: Using an empty string will attach the exit order to all entries.
          If you have a suggestion for making this clearer, I will happily ask that change gets made.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by danitralla, Today, 01:23 AM
          0 responses
          1 view
          0 likes
          Last Post danitralla  
          Started by superg3, Today, 12:33 AM
          0 responses
          3 views
          0 likes
          Last Post superg3
          by superg3
           
          Started by vppzepuq, Yesterday, 11:28 PM
          0 responses
          2 views
          0 likes
          Last Post vppzepuq  
          Started by Steve L, 05-25-2019, 10:04 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by mestril, 05-25-2019, 10:22 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X