Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi all,
After reading that the refreshing frequency of the drawn objects depends on a few events and the chart properties Display Update Interval I came across the option to override the Plot() method and calling it with a timer iterval.
I am trying to call the Plot() method as overridden in costumePlotSample indicator, that comes with NT7, but one thing I do not understand, how do I call the it from the timer event? Plot() didn't work because it needs 4 parameters.
How should I call Plot?
I would also appreciate it if you can tell me how the refresh will work after I use a 100ms interval. Will Plot() be called again from other events?
Can you help answer these questions from other members on NexusFi?
In a nutshell you don't, and you don't want to be doing that anyway, trust me I'm a doctor.
The Plot parameters are generated with a validated graphics context from system update and paint events, you can't store or generate them yourself and there is no need to.
The way to change Plot frequency is in the Chart Properties, much less than 400ms is pointless as you are not going to see it anyway.
It will always get called by other events in any case, usually when price/values have moved or objects have been drawn and it's longer than the last time interval for display update.
Plot will always get called if there is a visible change required on the screen, you don't need to attempt a redirect or build a new refresh approach.
You can however call ChartControl.Refresh() if you absolutely want to create guaranteed screen paints independent of price moves, for example if you are showing a bar timer or such like. I do this myself at certain times in a couple of charts with a one second timer.
NB For simple things I find using Windows.Forms.Timers easier as they are running synchronously in the main event loop anyway, less accurate but less to handle.
The problem I had before was that I used Draw commands in OnMarketData events that were updated only once in a few seconds even though my display update interval was set to 0.1 seconds. I did output to the data as well to the output window and saw that I have many events within this interval.
Doesn't this contradicts what you said that any change will be plotted as it arrives?
And another question, what is the difference between the Invalidate method to the refresh?
The changes will get output on your display update interval if price has moved, they may not become visible otherwise unless you have called Invalidate or Refresh. Normally I only draw using NT routines in OnBarUpdate or use low level graphics calls in Plot. I do use OnMarketData but have not used graphics from inside there so can't comment on that.
Little difference between Invalidate and Refresh, the former generates a queued paint event until all current processing is done then the Paint event will trigger, Refresh just triggers a Paint immediately.
Also in my experience the TriggerCustomEvent route is only necessary if NT bar indexes and such like are involved.
I don't know, I've just never tried it. I agree it is likely to be similar (and is in the same event loop) but you can get lots of OMD events (e.g. bid/ask/vol) without getting a price-moving OBU event.
Maybe email NT support to get clarification if you really need it. Alternatively you can just process data in OMD into a saved/active area and output NT gfx from OMD or a timer routine (adding an Invalidate or Refresh as needed if you are drawing something that can change without price or other indicator Values changing), or use low level gfx from Plot.
It's always worth thinking about when CPU work actually needs to be done for the brain to see something useful. More thinking along delayed processing lines would have lead to a lot less inefficient indicator code than NT7 has been typically been saddled with.
A few more questions about the chartControl. The intellisense gives me many things to work with, is there a guide for this that someone wrote? If not can you please specify what are the methods you work with? And what is the chartPanel within the chartControl?
No guides available as it's all unsupported NT stuff although it does tend to behave fairly well. Best approach is to learn a bit about general Windows Forms Controls, fastest way is just to Google "C# <subject>". You will also find lots of existing code on futures.io (formerly BMT) and in the NT support forum areas.
The ChartPanel is the graphics subpane of the Window, so without borders.
Best other learning route is simple Prints on the variables, I have not found use for that many of the methods and prefer to avoid close coupled hooks if I can.
Final caveat is that NT8 uses a completely different foundation layer (WPF) instead of Forms, so maybe don't invest too heavily unless you are happy to do so. Personally I think Forms and NT7 will be still around for a long time but it will be interesting to see if the next generation does have better documented APIs.
Won't it? Couldn't have much worse. (API documentation, that is.)
I don't want to barge in, but with NT8 presumably getting near to its release (anyone have any word on that??), I was going to say that getting too deeply into NT7, or perhaps doing very much with it at all, except purely surface stuff, may not be a great idea.
That said, I have stayed away from the NT8 beta project, not wanting more complication right now, and so I don't really know how NT8 will turn out. Are you in it, or do you otherwise have an idea?