Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars == NULL

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

    Bars == NULL

    Hi,
    I develpoed a small indicator that works fine.

    At the indicator I am checking if (Bars==NULL) before doing any operations on Bars.x

    Now, I am trying to develop a strategy based on this indicator.
    I see that when the strategy is calling the indicator I always get Bars==NULL (I see it by debugging print at the output widow)

    Can you help please why does it happen?

    thanks,

    r.

    #2
    Not sure I follow. Bars != null, *always* true in OnBarUpdate().

    Comment


      #3
      Bars == NULL

      Originally posted by NinjaTrader_Dierk View Post
      Not sure I follow. Bars != null, *always* true in OnBarUpdate().
      Hi Dierk,

      The indicator I wrote works fine (Bars != NULL)

      At the indicator's Init:

      Print("my indicator: before");
      if (Bars==NULL) return;
      Print("my indicator: after");

      and I do see "my indicator: before" and "my indicator: after" at the output window.


      But...
      I wrote a simple strategy and wanted to use this indicator.
      At the strategy Init - I wrote: Add(my_indicator);
      And I activated the strategy.
      Looking at the output window I see:
      "my indicator: before"
      but I don't see "my indicator: After"

      I asumme that Bars==NULL is the reason.

      When the strategy is calling the "onBarUpdate" of the indicator, any attempt to read from "Bars" fail.

      any idea?

      Thanks.

      Comment


        #4
        You should not access "Bars" property in the Initialize method. Please redesign your logic accordingly.

        Comment


          #5
          Bars==Null

          Originally posted by NinjaTrader_Dierk View Post
          You should not access "Bars" property in the Initialize method. Please redesign your logic accordingly.
          Thanks Dierk
          I'll give it a try!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          106 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          54 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          36 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          38 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          74 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X