NexusFi: Find Your Edge


Home Menu

 




Tick Bar Duration


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 3 posts (3 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 jitasb with 1 posts (0 thanks)
    4. looks_4 eyagan with 1 posts (0 thanks)
    1. trending_up 8,972 views
    2. thumb_up 9 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now, It is 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

Available coupon codes for premium Elite Membership:
  • If you are a researcher and pay attention to details, you qualify for our 10% discount - "CHARTIST"
  • If you are a veteran or in public/community service, you qualify for 15% discount - "PURPLECHART"
  • If you are 60+ years old, you qualify for our 20% discount - "WISDOM"
  • Discounts are based on the honor system. If we can't trust you to do the right thing, please move along.

(If you already have an account, login at the top of the page)

 
Search this Thread

Tick Bar Duration

(login for full post details)
  #1 (permalink)
 jitasb 
London, England
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB, Kinetic
Trading: Stocks
Posts: 513 since Oct 2010
Thanks Given: 22
Thanks Received: 226

Using Tradestation.

Need some help with displaying the duration of a Tick Bar as an indicator.
I.E I want to know how long it took for a each bar on a tick chart to complete: it will obviously be different for each bar e.g. 120secs, 180 secs, 20secs etc etc.

I can use the Time reserved word to work out the time each bar closed, but not sure how to convert that to seconds and also to find out what time the bar opened, in order to work out the elapsed time.

Hope someone can help.

Many Thanks

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT8 Historical Data
NinjaTrader
Resources to help learn about diversification of algo po …
NinjaTrader
Actual code for RSI using Wilders average, not the canne …
ThinkOrSwim
BollingerPro discussion
The Elite Circle
RangeDisparityMeter Indicator for NT8
Platforms and Indicators
 

(login for full post details)
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Swing Trader
Data Scientist & DevOps
 
Experience: Advanced
Platform: Custom solution
Broker: Collect them all
Trading: Equities, Futures & Crypto
Posts: 49,902 since Jun 2009
Thanks Given: 32,906
Thanks Received: 100,815



jitasb View Post
Using Tradestation.

Need some help with displaying the duration of a Tick Bar as an indicator.
I.E I want to know how long it took for a each bar on a tick chart to complete: it will obviously be different for each bar e.g. 120secs, 180 secs, 20secs etc etc.

I can use the Time reserved word to work out the time each bar closed, but not sure how to convert that to seconds and also to find out what time the bar opened, in order to work out the elapsed time.

Hope someone can help.

Many Thanks

TradeStation doesn't support second resolution, you would need to use MultiCharts.

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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Lifetime Elite Membership: Sign-up for only $100 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: in the NexusFi redesign thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #4 (permalink)
Jeff65
Gurnee, IL
 
Posts: 46 since Apr 2010
Thanks Given: 17
Thanks Received: 97


jitasb View Post
Using Tradestation.

Need some help with displaying the duration of a Tick Bar as an indicator.
I.E I want to know how long it took for a each bar on a tick chart to complete: it will obviously be different for each bar e.g. 120secs, 180 secs, 20secs etc etc.

I can use the Time reserved word to work out the time each bar closed, but not sure how to convert that to seconds and also to find out what time the bar opened, in order to work out the elapsed time.

Hope someone can help.

Many Thanks

You can pull the time in seconds it took to draw a tick bar by using the time pulled from you computer via the "ComputerDateTime" call. The following code should work with intrabarpersist disabled. The variable "LastDuration" will hold the time in seconds it took the last bar to form.


 
Code
variables:
   MyTime(0),
   LastDuration(0),
   MyCurrentBar(0);
   
   
   If ( CurrentBar > MyCurrentBar ) Then
    Begin
      MyCurrentBar = CurrentBar;
      MyTime = ComputerDateTime;
    End;
 
   LastDuration = SecondsFromDateTime( ComputerDateTime - MyTime[1] );

Reply With Quote
The following 6 users say Thank You to Jeff65 for this post:
(login for full post details)
  #5 (permalink)
 
greenroomhoo's Avatar
 greenroomhoo 
annapolis USA
 
Experience: Intermediate
Platform: Ninja, MC, Sierra, Amibroker
Broker: PFG (too bad), IB, Fidelity, AMP
Trading: ES, NQ, Equities, Forex, Etc.
Posts: 276 since Jun 2011
Thanks Given: 107
Thanks Received: 235

this code is very helpful. Also on a similar quest in Tradestation. It does a great job of posting real time. Does anyone know a way of Storing that data in case of chart reload etc?

Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Swing Trader
Data Scientist & DevOps
 
Experience: Advanced
Platform: Custom solution
Broker: Collect them all
Trading: Equities, Futures & Crypto
Posts: 49,902 since Jun 2009
Thanks Given: 32,906
Thanks Received: 100,815


greenroomhoo View Post
this code is very helpful. Also on a similar quest in Tradestation. It does a great job of posting real time. Does anyone know a way of Storing that data in case of chart reload etc?

For historical bars (and even real time bars) I think you should just compare Close-to-Close times to find the duration.

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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Lifetime Elite Membership: Sign-up for only $100 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: in the NexusFi redesign thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
(login for full post details)
  #7 (permalink)
eyagan
Antalya Turkey
 
Posts: 1 since Mar 2012
Thanks Given: 0
Thanks Received: 0


Big Mike View Post
For historical bars (and even real time bars) I think you should just compare Close-to-Close times to find the duration.

Mike

Can someone help me with this simple code pls.
I am collecting the data in seconds between each bar with the suggested code.
But it only plots that data starting from the time I put that indicator on the screen.
Obviously, close-to-close comparison should be done.
But I am inexperienced to do that simple change.


variables:
MyTime(0),
LastDurationSeconds(0),
LastDurationMinutes(0),
TotalSeconds(0),
MyCurrentBar(0);


If ( CurrentBar > MyCurrentBar ) Then
Begin
MyCurrentBar = CurrentBar;
MyTime = ComputerDateTime;
End;

LastDurationSeconds = SecondsFromDateTime( ComputerDateTime - MyTime[1] );
LastDurationMinutes = MinutesFromDateTime( ComputerDateTime - MyTime[1] );
TotalSeconds = LastDurationSeconds + (60 * LastDurationMinutes);
Plot1 (TotalSeconds, "Last Duration")

Reply With Quote
(login for full post details)
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Swing Trader
Data Scientist & DevOps
 
Experience: Advanced
Platform: Custom solution
Broker: Collect them all
Trading: Equities, Futures & Crypto
Posts: 49,902 since Jun 2009
Thanks Given: 32,906
Thanks Received: 100,815


eyagan View Post
Can someone help me with this simple code pls.
I am collecting the data in seconds between each bar with the suggested code.
But it only plots that data starting from the time I put that indicator on the screen.
Obviously, close-to-close comparison should be done.
But I am inexperienced to do that simple change.


variables:
MyTime(0),
LastDurationSeconds(0),
LastDurationMinutes(0),
TotalSeconds(0),
MyCurrentBar(0);


If ( CurrentBar > MyCurrentBar ) Then
Begin
MyCurrentBar = CurrentBar;
MyTime = ComputerDateTime;
End;

LastDurationSeconds = SecondsFromDateTime( ComputerDateTime - MyTime[1] );
LastDurationMinutes = MinutesFromDateTime( ComputerDateTime - MyTime[1] );
TotalSeconds = LastDurationSeconds + (60 * LastDurationMinutes);
Plot1 (TotalSeconds, "Last Duration")

You don't want computer time. You want bar time (Time[0] and Time[1]).

So maybe SecondsFromDateTime(ELTimeToDateTime(Time[1]) - ELTimeToDateTime(Time[0]))

untested.

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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Lifetime Elite Membership: Sign-up for only $100 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: in the NexusFi redesign thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
The following 3 users say Thank You to Big Mike for this post:





NexusFi Trading Community Platforms and Indicators EasyLanguage Programming > Tick Bar Duration


Last Updated on March 15, 2012


© 2023 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