View Full Version : Problem with Session Start Time
01-14-2009, 05:49 AM
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?
01-14-2009, 06:03 AM
I suggest to take a look at the link below, which will provide information regarding a time filter to limit trading hours.
01-14-2009, 06:20 AM
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.
01-14-2009, 07:27 AM
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.
01-14-2009, 10:30 AM
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.
01-14-2009, 10:59 AM
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.
01-14-2009, 11:14 AM
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.
01-14-2009, 11:20 AM
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.
01-14-2009, 11:22 AM
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.
01-14-2009, 11:36 AM
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.
01-14-2009, 11:44 AM
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.
01-14-2009, 11:49 AM
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.
01-14-2009, 11:50 AM
fair enough, good idea. i will try that.
be back in a few days :eek: