Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress...

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

    BarsInProgress...

    Hi,

    I wrote two indicators which I want to use at a strategy.
    Each Indicator is plotting 3 chart-lines:
    At Indicator A:
    Values[0].set(value1A);
    Values[1].set(value2A);
    Values[2].set(value3A);

    At Indicator B:
    Values[0].set(value1B);
    Values[1].set(value2B);
    Values[2].set(value3B);

    At the strategy (Initialize) I wrote:
    Add (IndicatorA(1,2,3) /* 1,2,3 = parameters to IndicatorA */);
    Add (IndicatorB(4,5,6) /* 4,5,6 = parameters to IndicatorB */);

    At the stategy's OnBarUpdate I try to access the values of the two indicators:
    Print (A(1,2,3).Values[0][0]);
    Print (A(1,2,3).Values[1][0]);
    Print (A(1,2,3).Values[2][0]);

    Print (B(4,5,6).Values[0][0]);
    Print (B(4,5,6).Values[1][0]);
    Print (B(4,5,6).Values[2][0]);

    I see that the strategy is calling the Indicators and I see both Indicators plots on the chart (all the plots are correct)

    Looking at the output window:
    The printing of IndicatorA values are right.
    But the values of IndicatorB always print the Close price value. (At the chart the plots are corect)

    I printed the BarsInProgress at the strategy OnBarUpdate, it is always = 0

    what am I doing wrong?

    thanks.

    #2
    Hi oferr,

    It is hard to tell without without seeing the exact implementation of indicator B. A potential issue may be the need to use Update() on your exposed property.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      BarsInProgress...

      Thanks Josh.

      Where whould you sugest to put the update() ?

      What other debugging can I try?

      Comment


        #4
        Where the property setter is. Print the values from the indicator and see what they return. See this tip on debugging too: http://www.ninjatrader-support.com/v...ead.php?t=3418

        Sorry if I seem vague because I cannot give you specifics without actual code.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi,
          At the indicator, I added prints (at the properties setter) of Values[0] , Values[1] and Values[2]
          It prints the Close price.

          I also put prints at the indicator where I am doing the Values[0].set ...
          It prints the right values.


          thanks.

          Comment


            #6
            In that case then I believe you do need the Update(). Please take a look at this reference sample on how Update() is used there. http://www.ninjatrader-support.com/v...ead.php?t=4991
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks. I'll try it!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              656 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              371 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
              579 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X