NexusFi: Find Your Edge


Home Menu

 





Getting Time[0] in session template timezone with a supereasy method...?


Discussion in NinjaTrader

Updated
    1. trending_up 1,635 views
    2. thumb_up 3 thanks given
    3. group 0 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
matevisky's Avatar
 matevisky 
Nelson, New Zealand
 
Experience: Beginner
Posts: 446 since May 2013
Thanks Given: 633
Thanks Received: 1,533

I am trying to cleanup my code, and make it work in everytimezone. I've checked many forum, about to how to make it simple, but as I see it is not simple, but maybe.
So here is the deal:
I am using 24/7 template to show my tick chart. My indicator only useable on this template anyway, so not a big deal.
I can spot, when the new session is starting that is cool ( Bars.FirstBarOfSession )

But here is the problem. Is there any supereasy way to get SessionTime in the Session Timezone instead of getting Time, on the current timezone? Really It would be superhelpfull to get all the time in the given sessiontemplate session timezone? Checking the time of day, checking is that a weekend or not, checking is that a holiday date or not would be much more easier....

If not, than I guess I have to use @Fat Tail conversition logic, to get the right time...

Thx in advnace

Mate


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
400 Million Barrels to Address Middle East Supply Disruption
Commodities
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
CME Lists U.S. Election Event Contracts as 2028 Democrat …
Prediction Markets & Event Contracts
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
26 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
matevisky's Avatar
 matevisky 
Nelson, New Zealand
 
Experience: Beginner
Posts: 446 since May 2013
Thanks Given: 633
Thanks Received: 1,533

Oke sorry. After some more deeper investigation: here is the answer

 
Code
				
Print(Bars.GetSessionDateFromLocal(Bars.Session, Time[0]));


Máté
Full time trader Live journal here
Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #3 (permalink)
 
matevisky's Avatar
 matevisky 
Nelson, New Zealand
 
Experience: Beginner
Posts: 446 since May 2013
Thanks Given: 633
Thanks Received: 1,533



matevisky View Post
Oke sorry. After some more deeper investigation: here is the answer

 
Code
				
Print(Bars.GetSessionDateFromLocal(Bars.Session, Time[0]));

Hm, this is stupid, but this function only give back the date, but not the time... I thought it is converting the Time[0] to session time, but not... make no sense. I will use @Fat Tail approach, as I see there is no easy way to do this, only the hard one. Converting the timezone into the session timezone


Máté
Full time trader Live journal here
Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 
matevisky's Avatar
 matevisky 
Nelson, New Zealand
 
Experience: Beginner
Posts: 446 since May 2013
Thanks Given: 633
Thanks Received: 1,533

Oke, here is the solution. It is looks good:

 
Code
DateTime instrumentSessionDate = TimeZoneInfo.ConvertTime(Time[0], TimeZoneInfo.Local, Bars.Session.TimeZoneInfo);


Máté
Full time trader Live journal here
Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:




Last Updated on October 23, 2014


© 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