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!
See more
See less

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 TradeSaber, Today, 07:18 AM
          0 responses
          4 views
          0 likes
          Last Post TradeSaber  
          Started by PaulMohn, Today, 05:00 AM
          0 responses
          9 views
          0 likes
          Last Post PaulMohn  
          Started by ZenCortexAuCost, Today, 04:24 AM
          0 responses
          6 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by ZenCortexAuCost, Today, 04:22 AM
          0 responses
          3 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by SantoshXX, Today, 03:09 AM
          0 responses
          17 views
          0 likes
          Last Post SantoshXX  
          Working...
          X