NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-18-2011, 01:53 PM   #1
ExactlyMyPoint
Junior Member
 
Join Date: Nov 2010
Location: Portland, OR
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
Send a message via MSN to ExactlyMyPoint Send a message via Skype™ to ExactlyMyPoint
Default Another timezone question

I am developing a strategy that takes a trade at a very specific time. Let's say 11:05 am Pacific Time.

I have code as follows

Code:
        
        private void TakeTrade()
        {
            TimeSpan timeToTakeTrade = new TimeSpan(11, 5, 0);
            DateTime Min5Time = Times[1][0];
            if (BarsInProgress == 1)    // 5 minute bars
            {
                if (Min5Time.TimeOfDay.CompareTo(timeToTakeTrade) == 0)
                    ProcessTrade();
            }
            else if (BarsInProgress == 0)    // daily bars
            {
                // do nothing
            }
        }
This works on my computer in Oregon, however, I am going to distribute this to people all over the country and it will not be accurate if they are running it say in Florida which is Eastern Time.

What do I need to do to set the timeToTakeTrade value correctly? Do I get the timezone from the user's computer or is there a better way?

Thanks
Last edited by ExactlyMyPoint; 02-18-2011 at 01:57 PM.
ExactlyMyPoint is offline  
Reply With Quote
 

Tags
time zone

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
TimeZone gg80108 Strategy Development 7 01-28-2011 09:58 AM
Changing TimeZone Joerg Miscellaneous Support 1 11-26-2009 12:07 PM
Timezone atrader101 Miscellaneous Support 5 04-06-2009 05:30 PM
how to change timezone? incrediblefx Charting 4 08-28-2008 10:37 AM
What Timezone is ET? Antraman ATM Strategies (Discretionary Trading) 3 01-02-2006 01:44 AM


All times are GMT -6. The time now is 10:48 AM.