Go Back   NinjaTrader Support Forum > NinjaTrader 7 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 02-22-2012, 12:52 PM   #1
Zapzap
Senior Member
 
Join Date: Aug 2008
Posts: 107
Thanks: 4
Thanked 13 times in 8 posts
Default Time of bar open and close

Is there a way to get the open and close time of a tick-chart bar?

I would like to make a small indicator that shows how much time was needed for eg. a 200 tick bar to get created.
Zapzap is offline  
Reply With Quote
Old 02-22-2012, 01:00 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 559 times in 549 posts
Default

Hello Zapzap,
Thanks for writing in and I am happy to assist you.

Unlike minute based bars where the end time can be predetermined, the end time of the tick bars cannot be predetermined. As such you cannot make an indicator which determines the end time of a tick bar.

I look forward to assist you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 02-22-2012, 01:18 PM   #3
koganam
Vendor
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 6,912
Thanks: 44
Thanked 2,807 times in 2,292 posts
Default

Quote:
Originally Posted by Zapzap View Post
Is there a way to get the open and close time of a tick-chart bar?

I would like to make a small indicator that shows how much time was needed for eg. a 200 tick bar to get created.
The time taken to build the last bar is:
Code:
TimeSpan timeElapsed = Time[2] - Time[1];
regardless of the type of bar you are using. If you want that in seconds, you will have to cast it correctly, thus
Code:
timeElapsed.TotalSeconds
By the same token, the time that has elapsed since the last bar, provided you have COBC = false, is Time[0] - Time[1].

That having been said, you sound like you are reinventing the wheel: NT ships with an indicator called BarTimer that does what you want.
Last edited by koganam; 02-22-2012 at 01:22 PM.
koganam is offline  
Reply With Quote
The following 3 users say thank you to koganam for this post:
Old 02-22-2012, 01:38 PM   #4
Zapzap
Senior Member
 
Join Date: Aug 2008
Posts: 107
Thanks: 4
Thanked 13 times in 8 posts
Default

Joydeep: I don't want to predetermine anything. I'd like to know "how much time was needed for a bar"

koganam: Thanks a lot I knew it was easy, I haven't programmed NT for 3 years though.

BTW: BarTimer is an indicator for minute based charts showing how much time is left. So I needed the new wheels.
Last edited by Zapzap; 02-22-2012 at 01:42 PM.
Zapzap is offline  
Reply With Quote
Old 02-22-2012, 02:58 PM   #5
koganam
Vendor
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 6,912
Thanks: 44
Thanked 2,807 times in 2,292 posts
Default

Quote:
Originally Posted by Zapzap View Post
...BTW: BarTimer is an indicator for minute based charts showing how much time is left. So I needed the new wheels.
Drat! Now why did I think that it was the other way round, and would only work on non-fixed timeframe charts? I must be going bonkers.
koganam is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate On Bar Close/Open-Low-High-Close relationship jkmott59 Indicator Development 6 04-10-2012 10:47 AM
Current Bar Open Equals Previous Bar Close ramacan Platform Technical Support 6 05-23-2009 11:07 AM
Backtest vs real-time Chart orders placed at Open of next bar vs Close of curr bar? tomace Platform Technical Support 3 03-18-2009 07:06 AM
Open and Close from same Bar RJay Strategy Development 3 03-04-2009 05:25 PM
Does NT simulator place orders at the Close of current bar, or Open of next bar? tomace Strategy Development 1 03-02-2009 01:43 PM


All times are GMT -6. The time now is 07:51 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content. Visit the CFTC resources for education regarding the industry and signs of fraud.