Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get BarsPeriod.Id for an indicator within a strategy

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

    Get BarsPeriod.Id for an indicator within a strategy

    Assume that a strategy call an indicator X, where X will do the following thing during the initialization:

    Add("MSFT", this.BarsPeriod.Id, this.BarsPeriod.Value, MarketDataType.Bid);
    Add("MSFT", this.BarsPeriod.Id, this.BarsPeriod.Value, MarketDataType.Ask);

    If I use X on a chart as an indicator, then it works fine. However, when I try to add the indicator in the Initialization() of a strategy, then BarsPeriod.Id (in X) is always "Minute", and BarsPeriod.Value is always "-1".

    Is there an easy fix for this without explictly passing the BarsPeriod to the indicator as a parameter?

    David

    #2
    David, thanks for reporting this in - we'll check into. Is this on lastest B21?

    Comment


      #3
      Yes, it is in Beta 21.

      David

      Comment


        #4
        Thanks David, will test it here and get back to you.

        Comment


          #5
          David, when I test it here I'm seeing this error - 'Add' method only accepts positive 'period' values, but was -1 Min - Bid

          You would need to pass in specific values as you can't Add() dynamically unfortunately.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          305 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          196 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          186 views
          1 like
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          274 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          228 views
          0 likes
          Last Post CarlTrading  
          Working...
          X