![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
I've implemented an indicator with some custom graphic code in the Plot() method following the example in CustomPlotSample. However, I am updating the indicator data asynchronously and I need to have it displayed immediately to the user. Is there any way I can programmatically induce a call to Plot() to achieve that? Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Unfortunately this is more general C# then NinjaScript therefore falls out of my ability to support. I do know that everything in NinjaTrader is driven by ticks recieved however and we do not support manually updating the chart. You would need to check out or post in this thread for unsupported Tips and Tricks: http://www.ninjatrader.com/support/f...supported+tips Good Luck! Let me know if I can be of further assistance.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Brett,
I can't find the information in that thread. I understand this is unsupported but can you at least point me out to some direction? Or maybe someone in the community knows? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
|
Would have to leave open for someone form the community to assist.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
|
Plot is an override, and I presume that that is what you have done, One way to call the Plot() method without calling the actual overridden function is to duplicate your custom Plot() code and call it by a different name.
Code:
private void PaintBars(Graphics graphics, Rectangle bounds, double min, double max)
{
//duplicate of custom Plot() code here
}
Last edited by koganam; 01-16-2011 at 07:17 PM.
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Koganam,
I don't have access to the Graphics and Rectangle objects needed to be passed to the drawing method (whether Plot or your PaintBars method) so I can't directly call it. I tried storing them on a first call of Plot but it's not working if I call Plot directly with these values. Only the subsystem has them so I guess I would need to invoke a refresh of the indicator panel or the entire window so it subsequently calls Plot. Does anybody knows how can I get a reference to the indicator panel or the window containing it from the indicator's code? (or any other way to achieve a call to Plot by the subsystem)
Last edited by supernatural; 01-17-2011 at 07:54 AM.
|
|
|
|
|
|
#7 | ||
|
Senior Member
|
Quote:
Quote:
|
||
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Dec 2010
Posts: 470
Thanks: 0
Thanked 4 times in 4 posts
|
Is there a problem with things like GC lifetime? Can you squirrel away a GC and expect it to be valid later? How about the other information passed in to Plot() as parameters -- is it guaranteed to still be valid when he does his ersatz Plot()? What about if the user has resized the screen in the meantime?
--EV |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Plot() is overridden and called by the subsystem which provides it with the necessary graphics objects. It is called at each new bar when a graphic event occurs in the graph window. I don't call Plot directly (but I'm trying to).
|
|
|
|
|
|
#10 | |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
I agree that would not be a clean way, and anyway it's not working. Probably the proper way to achieve a call to Plot would be to call a refresh on the window containing the indicator panel, which would then force a call to Plot. The problem is how can I get a handle to that window from the indicator's code...
Quote:
|
|
|
|
|
|
|
#11 |
|
Senior Member
|
So is your original statement then incorrect? Have you or have you not written a custom plot that overrides the default Plot() method? Your initial statement implies that you have. Am I missing something here ?
|
|
|
|
|
|
#12 |
|
Senior Member
|
|
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
Yes I did override Plot and it works. But it is called (implicitely) at each bar. And I want to call (explicitely) it between bars, at any time I want. This is because I am updating my indicator with data that is downloaded from the internet and that data is updated asynchronously.
|
|
|
|
|
|
#14 | |
|
Senior Member
|
Quote:
Why do you think that a copy of that method, with the same signature, cannot access a graphics object? |
|
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jul 2009
Location: Western Europe
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Failed to call method 'Initialize' | daven | Miscellaneous Support | 2 | 07-30-2010 07:01 AM |
| Failed to call method 'Initialize' for strategy ' | richa61416 | Version 7 Beta General Questions & Bug Reports | 10 | 04-23-2010 04:20 AM |
| Can I call a method from another | kaywai | General Programming | 2 | 02-24-2010 07:05 AM |
| failed to call method 'initialize' for indicator | tinkerz | General Programming | 4 | 02-22-2010 09:46 AM |
| ERROR: Failed to call method 'Initialize' for indicator | NinjaCustomer | Indicator Development | 11 | 12-09-2009 05:41 AM |