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)
Since in NT, I cannot get my X axis to reflect exchange time, I wrote a silly little indicator to display exchange time. It is obnoxiously inconsistent. Does any one here know why?
Can you help answer these questions from other members on NexusFi?
I do not know, but it is possible that the 2 charts use different session templates, and that one of the session templates was EST and the other one Central Time.
Another potential explanation is that you used Time[0]. This will convert the last bar time to current time, but not display the time as per now. If you want to know the time right now, you would need to use DateTime.Now instead of Time[0], eventually improve this to allow for display of time under replay conditions.
Bingo! I had one template that had inadvertently saved the wrong session for CL (CME US Index Futures ETH) which is apparently Central. I believe CL to be eastern exchange timezone. Thanks! It helps to know where to look.
I do use Time[0]. In general the current bar tick time seems appropriate.
Wouldn't DateTime.Now always give the here and now rather than a time related to the chart time?
Correct, if you use Time[0], that could be either be the last bar currently displayed on your chart, or when scrolling back horizontally the last hidden bar on the right edge of your chart series.
If you really want that the time relates to the last bar shown on your chart (even when scrolling back) you would need to override the Plot() method or access ChartControl directly from within OnBarUpdate().
You also need to create a Timer() if you want it to update each second, otherwise it may not update for several seconds if there is a pause in incoming ticks if you have it in onbarupdate with cobc=false.
There is an example of this in one of the built-in NT indicators if I remember right, the one that measures the countdown timer/minutes remaining for a minute chart, whatever its called.
That really depends on what one is trying to achieve. The code example uses the Time[0], which is the time of the last bar of the bar series.
For this logic the timer would not be needed, as
-> for minute built bars it will display the projected time of completion of the bar
-> for bars built from ticks it will show the time of the last tick
For both cases the timer is not required. Inconvenient of this logic is that the time displayed is not necessarily the time of the last bar displayed on the chart, which is not CurrentBar, but LastBarIndexPainted and can only be accessed through ChartControl.
The Timer() would only be needed, if DateTime.Now is used, which will increase irrespectively whether a new incoming tick triggers OnBarUpdate() or not.
You can find out by copying code from other indicators. Step by step you will understand what it means. That is the only way to go. I am a code-copy-master, as it is the fastest way to achieve the goal.