NexusFi: Find Your Edge


Home Menu

 





Time of x ticks bar


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one TraderWalrus with 2 posts (0 thanks)
    2. looks_two ABCTG with 2 posts (3 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Cosmos110 with 1 posts (0 thanks)
    1. trending_up 4,288 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
TraderWalrus
Bangkok Thailand
 
Posts: 36 since May 2016
Thanks Given: 15
Thanks Received: 17

In case of using bars of 100 ticks each (for example) - how is it possible to find the time difference between the current and previous bar?

The Time() function only returns hours and minutes. Is there a way to get the time of the previous bar with an accuracy of seconds?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


TraderWalrus,

"Time_s" is time accurate to seconds, "DateTime" would even give you millisecond accuracy.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
TraderWalrus
Bangkok Thailand
 
Posts: 36 since May 2016
Thanks Given: 15
Thanks Received: 17

I tried to use time_s - time_s[1] to get the difference in seconds between the current and the previous bar, it works as long as both bars are in the same minute.

Any easy way to calculate this difference when the bars are in different minutes / hours? is it possible to convert the value returned by time_s to seconds since midnight for example?


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

TraderWalrus,

you can't just subtract these time values without running into the issue you describe - it would be the same for "Time - Time[1]". One approach is to use the TimeToSeconds function to convert the time to seconds (for both time values) and then build the difference between seconds.
Keep in mind that you might get negative times in case the previous bar is on the previous day, while the current bar is on the current day.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
Cosmos110
Coldspring, TX
 
Posts: 1 since Jul 2017
Thanks Given: 0
Thanks Received: 0

I use Ninja Trader and I crossed this problem before. I can't say I ever made any use out of it but maybe you can (and then give it back to me). I put a screen shot in an attachment. This is using an overlay on my chart and then changing one chart from "Time" to "Ticks" so that I have both of them on one chart for comparison. I wondered if one chart would show a pattern that the other one didn't but I never managed to use it on anything myself.
.................


Attached Thumbnails
Click image for larger version

Name:	2017-07-20_9-47-43.jpg
Views:	276
Size:	299.6 KB
ID:	238600  
Reply With Quote




Last Updated on July 21, 2017


© 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