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 CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,265 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          12 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X