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 > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 01-14-2009, 05:49 AM   #1
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default Problem with Session Start Time

Hi,

I have a strategy that has day bars as its primary, but uses minute bars internally for some actions (mostly, stop loss management).

When I start the strategy, I do not have the option of setting the session start and end?

First, it tried to submit a market order several hours before the market opened. The order was rejected by MBTrading. The strategy is coded to only place orders based on daily bars -- but how do i get it to constraint its activities to market hours?

Also, since I am using minute bars to manage my exit, how do i prevent it from reacting to after market data, since the session start and end is not available for me to configure during strategy startup?

Thanks,
Brandon
bridenour is offline  
Reply With Quote
Old 01-14-2009, 06:03 AM   #2
NinjaTrader_Jason
NinjaTrader Customer Service
 
NinjaTrader_Jason's Avatar
 
Join Date: Aug 2007
Location: Breda, Netherlands
Posts: 11,226
Thanks: 83
Thanked 333 times in 325 posts
Default

Hello Brandon,

I suggest to take a look at the link below, which will provide information regarding a time filter to limit trading hours.
http://www.ninjatrader-support2.com/...ead.php?t=3226
NinjaTrader_Jason is online now  
Reply With Quote
Old 01-14-2009, 06:20 AM   #3
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

So, basically, unless i explicitly code it not to do so, a strategy based on day bars is always going to execute trades in the pre-market. Seems crazy...

Why you would have session start and end time for minute bars, and then remove it for day bars with this result, is very puzzling. Im sure most people who create a strategy don't want it executing orders in the pre-market.
bridenour is offline  
Reply With Quote
Old 01-14-2009, 07:27 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Just use minute bars as primary or do what Jason stated. From a daily bar stand point there is no "session". It is just a bar as provided by the data provider. The strategy dialogue window does not know you have a secondary bar object in the wings.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-14-2009, 10:30 AM   #5
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks, i will try using minute bars as the primary and days as secondary - maybe that will fix it.

However, the big problem was that the system submitted an order based on the daily bars. All my order entry is off the daily bars, and it seems like it processed this before the market opened. In fact, they were submitted around 2am.

Maybe im just mistaken and MBtrading would hold these orders properly until market opens? I'm not sure, as one of the orders was rejected by MBTrading as having an invalid TIF.

Thanks
bridenour is offline  
Reply With Quote
Old 01-14-2009, 10:59 AM   #6
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

The order would have been processed on the close of the prior daily bar which can only happen on the 1st tick of the next daily bar. Will look into this further.
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-14-2009, 11:14 AM   #7
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok thanks. I started the strategy yesterday after market close, primarily because i knew a buy signal would be generated for today. It looks like around 2am NT generated a buy order to MBTrading. The signal would have been generated based on the closing price yesterday.

Any help you can give me understanding the order and timing of executions when using the daily bar would be helpful. Ultimately, I need signals generated off of yesterdays closing price to execute at the market open the next day.

Thanks
bridenour is offline  
Reply With Quote
Old 01-14-2009, 11:20 AM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

bridenour,

If a signal was generated at 2am I am lead to believe that you had data coming in at 2am for your minute time frame. You are sending the orders from the minute time frame correct?

If that is the case you really need to just add a time filter.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-14-2009, 11:22 AM   #9
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

I am only sending orders off of the day bars. Day is my primary bar configuration.

I just use the minute bars as part of a stop loss/exit strategy.

When would i normally expect to receive the daily bars? When would a day bar normally generated a buy signal, if that is where i place it?


I am going to implement the time filter also, but im concerned that is not going to address the day bar signal issue.
bridenour is offline  
Reply With Quote
Old 01-14-2009, 11:36 AM   #10
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Daily bars are built whenever your data provider offers that information. When NT receives a tick for that bar it plots it onto the chart. I am lead to believe that your next day's bar was created at 2am. As Ray mentioned, when you submit your order at the close of a bar it will execute at the open of the next daily bar. It seems to me the open of this next bar happened at 2am and that is what is causing you concern.

If you are submitting from the daily bars the time filter will not work.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-14-2009, 11:44 AM   #11
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the reply.

It seems like, based on what you are saying, using the daily bars for an ATS just won't work with Ninja Trader. If there is no way to effectively control and ensure that orders are placed during market hours, that would seem to suggest the product just won't work for multi-day trading or trading based on daily bars (rather than intraday bars) .

I use MBTrading, which based on my research is/was one of your well-supported execution brokers.

I'm very surprised that such a broad category of functionality is not supported. I researched for a couple of weeks here and did not see anyone else mention this limitation, and yet, if this is indeed a limitation, i can't imagine how anyone could use the product for this purpose.

For the system I'm automating, i can't move the entry signals to the minute bars, as they are fundamentally generated off of day timeframe conditions.
bridenour is offline  
Reply With Quote
Old 01-14-2009, 11:49 AM   #12
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Sure you can. In the daily tiime frame when you decide a signal, mark it with a temp variable. Then on the first time filterized minute bar submit that trade when temp variable is true. Reset temp variable to false. It will get you in at the same spot you hoped for otherwise.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-14-2009, 11:50 AM   #13
bridenour
Senior Member
 
Join Date: Jan 2009
Posts: 156
Thanks: 0
Thanked 0 times in 0 posts
Default

fair enough, good idea. i will try that.

be back in a few days
bridenour is offline  
Reply With Quote
Reply

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
Session Start/End Settings boblin Charting 2 09-14-2010 03:44 AM
Session Time Problem Freddie Charting 19 02-12-2010 01:59 PM
How to set session start/stop time in NS? henry.omd Strategy Development 1 01-11-2008 02:31 PM
Changing Session Begins and Session Ends time forexample Charting 1 10-21-2007 01:16 AM
Session Start/End Time MindSabre General Programming 1 04-29-2007 12:29 AM


All times are GMT -6. The time now is 03:43 AM.