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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          655 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          577 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X