NexusFi: Find Your Edge


Home Menu

 





reporting exchange time


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 4 posts (2 thanks)
    2. looks_two LostTrader with 3 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,534 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64

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?


Attached Thumbnails
Click image for larger version

Name:	NT time.png
Views:	183
Size:	45.1 KB
ID:	41113  
Attached Files
Elite Membership required to download: ExchangeTime.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
CME Raises Energy Futures Margins After Iran-War Volatil …
Commodities
CME Group Fee Schedule Changes Hit All Four Exchanges -- …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114



LostTrader View Post
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?

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.


Reply With Quote
Thanked by:
  #4 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Fat Tails View Post
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?


Started this thread Reply With Quote
  #5 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


LostTrader View Post
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().


Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

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.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


Big Mike View Post
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.

Mike

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.


Reply With Quote
Thanked by:
  #8 (permalink)
 
LostTrader's Avatar
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
Posts: 74 since Sep 2009
Thanks Given: 21
Thanks Received: 64


Fat Tails View Post
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.

I did not know there was such a thing as "LastBarIndexPainted" ! It is not in the NT help guide.
Useful to know. Thanks, Fat Tails!


Started this thread Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


LostTrader View Post
I did not know there was such a thing as "LastBarIndexPainted" ! It is not in the NT help guide.
Useful to know. Thanks, Fat Tails!

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.


Reply With Quote




Last Updated on June 23, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts