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 2,827 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 2 attachments




 
Search this Thread

reporting exchange time

  #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:	124
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?
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



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, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


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,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,662

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 Twitter 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, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


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, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts