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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          144 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          70 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          125 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          78 views
          0 likes
          Last Post PaulMohn  
          Working...
          X