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)
I would like to get some help in identifying when the last [right-most] candle has finished drawing on a "static" chart. By "static" chart, I mean that the chart is pulled up based on the data from the last time the Ninjatrader session was closed down/exited, and before the user "connects" manually via the menu option to the data provider to get the latest candles.
Let me share some information on why I need this. I have a function that needs to be triggered to run only on the last candle drawn on the static chart and not any older historical candles before that. I know about the History() function but am still having problems as even the last [right-most] candle is considered historical (on a static chart) before connection to the provider.
Thanks in advance for any suggestions and/or guidance.
Webby
Can you help answer these questions from other members on NexusFi?
My thought would be to investigate using a timer (e.g 5 seconds or whatever) which is set on every 'Historical' bar that is processed in OnBarUpdate, thereby each incoming bar would simply reset the time condition and the timer itself would only actually fire on the last bar as you want.
It would obviously not be set at all when running live, and assumes that the specified delay is longer than the time to process each sequential historical bar (probably by a long margin) and short enough not to affect what you want to do (seems likely.)
You also might want to use the TriggerCustomEvent routine if it needs to be data safe within the Ninja data series areas.
I use this sort of technique for saving last bar of session data out to custom ascii files and guaranteeing to get all ticks in and it's been reliable.