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 Jeff65 with 1 posts (6 thanks)
    3. looks_3 greenroomhoo with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 9,149 views
    2. thumb_up 9 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
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?
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Volume profile TradeStation
EasyLanguage Programming
Request for MACD with option to use different MAs for fa …
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
36 thanks
GFIs1 1 DAX trade per day journal
25 thanks
Supertradersams Thread Journal on NQ/MNQ
24 thanks
Deaddogs Stock Trading
23 thanks
Leaving CFD trading and learning futures
13 thanks

(login for full post details)
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,233 since Jun 2009
Thanks Given: 33,105
Thanks Received: 101,350



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 $149 USD
Receive exclusive 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
(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
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,233 since Jun 2009
Thanks Given: 33,105
Thanks Received: 101,350


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 $149 USD
Receive exclusive 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
(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
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,233 since Jun 2009
Thanks Given: 33,105
Thanks Received: 101,350


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 $149 USD
Receive exclusive 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
The following 3 users say Thank You to Big Mike for this post:





Last Updated on March 15, 2012


© 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