NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 02-14-2012, 07:43 PM   #1
flonkle
Junior Member
 
Join Date: Jun 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default 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.
flonkle is offline  
Reply With Quote
Old 02-15-2012, 02:59 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
Default

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.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-15-2012, 09:43 AM   #3
flonkle
Junior Member
 
Join Date: Jun 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default

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?
flonkle is offline  
Reply With Quote
Old 02-16-2012, 11:56 AM   #4
flonkle
Junior Member
 
Join Date: Jun 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default

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.
flonkle is offline  
Reply With Quote
Old 02-16-2012, 12:01 PM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 973 times in 956 posts
Default

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.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-16-2012, 12:31 PM   #6
flonkle
Junior Member
 
Join Date: Jun 2011
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default

Thanks. I'll look into the CustomPlotExample to see what I can find out from it.
flonkle is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect output from TickCounter MikeInMA Version 7 Beta General Questions & Bug Reports 1 10-18-2010 12:43 PM
TickCounter text location ssg10 Indicator Development 4 02-10-2009 01:53 AM
TickCounter comes with sound alert? Greenmoney21 Suggestions And Feedback 12 08-07-2008 05:38 AM
TickCounter T.D.NINJA Suggestions And Feedback 1 06-04-2008 03:55 PM
TickCounter Indicator (Download) Version 5 Only NinjaTrader_Ray Indicator Development 0 04-06-2006 01:28 PM


All times are GMT -6. The time now is 03:00 PM.