Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Vestigial symbol

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

    Vestigial symbol

    I presume this is something that I am missing, but I could use some help understanding what that might be. I have a very simple workspace right now:
    • Control Center
    • Chart -- with just one tab, set to ^SPX monthly
    • NinjaScript Output

    My problem is that OnBarUpdate() is getting called once for ^SPX, and then called a second time for BIL. I did have the chart set to BIL at one time, but no longer do. BIL is still in the Select drop down list (along with a few others), but that's the only reference to BIL that I am aware of. Some things I have tried, with no success:
    • Switch charted symbols. The new symbol gets charted, but OnBarUpdate() still gets called twice, once for the new symbol, and once for BIL
    • Delete the chart and make a new chart. That does not help -- still the same problem.
    • Exit NinjaTrader and restart it. No help.
    • Delete the chart, exit NinjaTrader (saving the workspace), restart NT, create a new chart -- still the same problem

    OK -- so please help me understand why BIL is so persistent. Why does NT think it has to call OnBarUpdate for BIL? How do I stop those unwanted calls?

    --EV

    #2
    I have implemented a tracing facility for my indicators. I find it helpful when debugging certain mysteries. I have included it below because:
    1. For anyone who is interested, it provides a complete and very clear record of how NT8 brings up an indicator
    2. It shows what I mean about OnBarUpdate() getting called for both the desired symbol (^SPX) and the vestigial symbol (BIL)

    --EV

    (The comments are hand edited -- they are not part of the tracing itself.)
    Code:
    // Note: the#<digit> notations are the object's serial number.  Each object has a unique serial number, monotonically increasing.
    
    // New indicator object constructed
    16:54:17  #3  Entry: VsaModelIndicator.VsaModelIndicator()  (Constructor started , State.SetDefaults)  CurrentBar=n/a   <no instrument>
    16:54:17  #3  Exit:   VsaModelIndicator.VsaModelIndicator()  (Constructor completed, State.SetDefaults)  CurrentBar=n/a   <no instrument>
    
    // New indicator object sets its default values
    // This call was artificially delayed until after the constructor finished
    16:54:17  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(SetDefaults) started, State.SetDefaults)  CurrentBar=n/a   <no instrument>
    16:54:17  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(SetDefaults) completed, State.SetDefaults)  CurrentBar=n/a   <no instrument>
    
    // NT carries forward the things it wants to make persistent
    // This is the  last call before putting up a dialog, so here is the place to extend or override what NT has done (if you need to)
    // FWIW: note that this is the first time the Instrument name is known
    16:54:17  #2  Entry: VsaModelIndicator.Clone()  (OnStateChange(SetDefaults) completed, State.SetDefaults)  CurrentBar=n/a   ^SPX (Daily)
                                        Cloning object #3 from object #2
    16:54:17  #2  Exit:   VsaModelIndicator.Clone()  (OnStateChange(SetDefaults) completed, State.SetDefaults)  CurrentBar=n/a   ^SPX (Daily)
    
    // Now the instance can do any initialization that was not needed when putting up the dialog
    16:54:17  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(Configure) started, State.Configure)  CurrentBar=n/a   ^SPX (Daily)
    16:54:17  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(Configure) completed, State.Configure)  CurrentBar=n/a   ^SPX (Daily)
    
    // Now that it is no longer needed for cloning, the old instance is destroyed
    16:54:17  #2  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(Terminated) started, State.Terminated)  CurrentBar=n/a   ^SPX (Daily)
    16:54:17  #2  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(Terminated) completed, State.Terminated)  CurrentBar=n/a   ^SPX (Daily)
    
    // State progression: State.DataLoaded
    16:54:20  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(DataLoaded) started, State.DataLoaded)  CurrentBar=n/a   ^SPX (Daily)
    16:54:20  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(DataLoaded) completed, State.DataLoaded)  CurrentBar=n/a   ^SPX (Daily)
    
    // State progression: State.Historical
    16:54:20  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(Historical) started, State.Historical)  CurrentBar=n/a   ^SPX (Daily)
    16:54:20  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(Historical) completed, State.Historical)  CurrentBar=n/a   ^SPX (Daily)
    
    
    // HERE IS THE ISSUE -- WHY ARE THERE CALLS FOR BOTH ^SPX AND BIL
    // (Entry and Exit prints are on the first and last bars, respectively)
    01/03/50  #3  Entry: VsaModelIndicator.OnBarUpdate()  (OnBarUpdate() started, State.Historical)  CurrentBar=0   ^SPX (Daily)
    05/30/07  #3  Entry: VsaModelIndicator.OnBarUpdate()  (OnBarUpdate() started, State.Historical)  CurrentBar=0   BIL (Daily)
    08/04/15  #3  Exit:   VsaModelIndicator.OnBarUpdate()  (OnBarUpdate() completed, State.Historical)  CurrentBar=16500   ^SPX (Daily)
    08/04/15  #3  Exit:   VsaModelIndicator.OnBarUpdate()  (OnBarUpdate() completed, State.Historical)  CurrentBar=2060   BIL (Daily)
    
    
    // State progression: State.Transition
    // All historical bars have been loaded by now
    08/04/15  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(Transition) started, State.Transition)  CurrentBar=16500   ^SPX (Daily)
    08/04/15  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(Transition) completed, State.Transition)  CurrentBar=16500   ^SPX (Daily)
    
    // State progression: State.Realtime
    08/04/15  #3  Entry: VsaModelIndicator.DoStateChange()  (OnStateChange(Realtime) started, State.Realtime)  CurrentBar=16500   ^SPX (Daily)
    08/04/15  #3  Exit:   VsaModelIndicator.DoStateChange()  (OnStateChange(Realtime) completed, State.Realtime)  CurrentBar=16500   ^SPX (Daily)
    Last edited by ETFVoyageur; 08-05-2015, 07:00 PM.

    Comment


      #3
      Never mind ... I just stumbled on the answer. Something was not working as I expected -- probably just means I need to get a little better educated.

      --EV

      Comment


        #4
        Thanks for the detailed tracing! Glad to hear you found the answer, though... Please let us know if there was something causing confusion on this behavior we could help with, or if you do not mind sharing what was going wrong.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          Thanks for the detailed tracing!
          You are welcome. That is a feature of my indicator base class. I find that it really helps me understand some otherwise-confusing situations.

          --EV

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by elirion, Today, 01:36 AM
          0 responses
          3 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by gentlebenthebear, Today, 01:30 AM
          0 responses
          4 views
          0 likes
          Last Post gentlebenthebear  
          Started by samish18, Yesterday, 08:31 AM
          2 responses
          9 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by Mestor, 03-10-2023, 01:50 AM
          16 responses
          391 views
          0 likes
          Last Post z.franck  
          Started by rtwave, 04-12-2024, 09:30 AM
          4 responses
          34 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Working...
          X