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 Jonker, Today, 01:19 PM
          0 responses
          1 view
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          4 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,789 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          838 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Working...
          X