Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

BarTimer and TickCounter

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

    BarTimer and TickCounter

    Hello,

    I've been toying around with the BarTimer indicator to customize it a little. I can do this, but I still don't really understand how the BarTimer indicator is being plotted.

    For example, the Plot() method is being overwritten in both the BarTimer and the TickCounter indicators. But I don't see anywhere where this method is being called. No Plots are added to the chart. Plot values are not being set. etc.

    Could someone please tell me how the Plot() method is being used in the BarTimer and/or TickCounter methods? How/when is this method being called to make these indicators update properly? From where is the Plot() method being called? etc.

    Like I say, I understand these indicators enough to modify them to work like I want them to, but I would really like to understand how they are being plotted. On this point, I'm confused.

    Thanks in advance for any help with this question.

    #2
    flonkle, these indicators are using advanced C# technique to achieve the display for which we here unfortunately could only offer limited support. In the Misc section the default Plot() method is overridden to allow for custom plotting / drawing with C#, this happens with the graphics.DrawString call later in this method code section then.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I understand that the default Plot() method is overridden and that graphics.DrawString is doing the drawing.

      I just want to understand the flow of control of the program so I can do stuff like this on my own if the need arises.

      In other words, what method is calling the Plot() method that is overridden in the BarTimer and TickCounter indicators?

      In the BarTimer indicator, the timer has a tick event that triggers multiple times a second and calls this eventhandler method:

      Code:
      private void OnTimerTick(object sender, EventArgs e)
              {
                  if (DateTime.Now.Subtract(lastTimePlot).Seconds >= 1 && DisplayTime())
                  {
                      ChartControl.ChartPanel.Invalidate();
                      lastTimePlot = DateTime.Now;
                  }
              }
      I don't see any other possible candidate for calling the Plot() method within the code visible in the BarTimer indicator. But I doubt that a call to ChartControl.ChartPanel.Invalidate() is going to call the Plot() method. Maybe this triggers the Plot() method to be called by some other code later, automatically; I don't know.

      As far as the TickCounter indicator is concerned, I see nowhere where the Plot() method is or even could be called. No events are thrown within the code, and the OnBarUpdate() method, which is called on every incoming tick, is empty.

      Please tell me how/when/where the Plot() method is being called in these indicators. I'd like to know so I can learn from these indicators as code examples.

      Thanks.

      P.S. There could be something going on in the NinjaTrader.Gui.Chart namespace that is calling the Plot() method. That is one of my guesses at the moment. Or, there could be something going on with the Indicator class itself, under the hood, that is doing the call. In any case, as a side question, is there any way for us end-users to see the structure of classes like NinjaTrader.Indicator.Indicator or the NinjaTrader namespace in general?

      Comment


        #4
        Anyone... bueller... bueller...

        I'm not trying to be a pain in the butt, so I apologize for hounding you guys for an answer about this. I do appreciate the NT staff answering me at all. However, if the NT guys are going to respond to this thread, I would appreciate an answer that addresses the question I actually posed in the thread, instead of giving me an answer that evades the question.

        If the NT guys are still monitoring this thread, please tell me about how the Plot() method is being called in the BarTimer and TickCounter indicators. If you can't tell me this, e.g. in order to protect the proprietary interests of NT, please inform me of this informational constraint, instead.

        Also, I would like to know how/if we end-users can learn about the structure of the NinjaTrader namespace and the classes within it. Again, if this is proprietary info that NT does not want to divulge to end-users, please tell me so in response to this thread.

        Thanks.

        Comment


          #5
          flonkle, working the overriden Plot() method is not officially supported / documented by us - it's available for advanced C# coders to offer the utmost of flexibility - to make yourself more familiar with it and start experimenting I would suggest checking into the CustomPlotExmaple shipped with NT for that purpose.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thanks. I'll look into the CustomPlotExample to see what I can find out from it.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by frankthearm, Today, 09:08 AM
            7 responses
            28 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by NRITV, Today, 01:15 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by maybeimnotrader, Yesterday, 05:46 PM
            5 responses
            25 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by quantismo, Yesterday, 05:13 PM
            2 responses
            16 views
            0 likes
            Last Post quantismo  
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            33 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X