NinjaTrader Support Forum  

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

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

Reply
 
Thread Tools Display Modes
Old 08-03-2009, 12:17 PM   #1
darckeen
Senior Member
 
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
Default Multi-Time Frame Order Delay

I'm using a strategy that has multi time frames of the same instrument. CalculateOnBarClose = true, the primary time fame is the smaller, i.e. 1min. the secondary time frame is larger i.e 60min. I'm evaluating an indicator in the secondary time frame and entering the trade on the primary time frame. My problem is that when a bar in the secondary time frame evaluates true and I EnterLong() the order executes one bar late in primary time frame.

For example, if in the 60 min time frame in the 8:00 bar i EnterLong() the order executes at the opening price of the 8:02 bar. I'd like to have the order execute at the open of the 8:01 bar.
darckeen is offline  
Reply With Quote
Old 08-03-2009, 12:36 PM   #2
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

darckeen,

You will need to swap your bars to have primary as the larger time frame series.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-11-2009, 01:58 AM   #3
darckeen
Senior Member
 
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok, I think I understand why the primary bar needs to be bigger. Another question, is it possible to create a strategy that trades multiple instruments?
darckeen is offline  
Reply With Quote
Old 08-11-2009, 06:03 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

darckee, yes this is possible as you can direct the order execution to different bars objects / instruments - http://www.ninjatrader-support.com/H...struments.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-13-2009, 06:48 PM   #5
darckeen
Senior Member
 
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok i've got a multi instrument strategy working and was wondering if there is anyway to visualize the trades for individual instuments other then the primary instrument in the strategy analyser chart pane.
darckeen is offline  
Reply With Quote
Old 08-14-2009, 03:36 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

darckeen, it would probably be easiest to print 'Positions' to the output window for this - http://www.ninjatrader-support.com/H...Positions.html

NinjaTrader 7 will offer a more detailed 'Strategies' tab for this - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 08-24-2009, 01:56 PM   #7
darckeen
Senior Member
 
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the help so far. A few more questions:

With a multi instrument strategy in backtesting the order of OnBarUpdate() always seems to go in the order that the instruments were Add() to the strategy. Will this hold true in live trading provided UpdateOnClose = true?

Also is there anyway to implement SetStopLoss() and SetProfitTarget() in another BarsInProgress?
darckeen is offline  
Reply With Quote
Old 08-24-2009, 02:19 PM   #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

darckeen,

When running a strategy live it doesn't matter what order you add them in. The events trigger in the order the data is received. If the primary is received first, then that will trigger first.

Set() are not tied to specific BarsInProgresses. They just work off the data. If price touches or passes the Set() order then the order will try to fill.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-28-2009, 06:27 PM   #9
darckeen
Senior Member
 
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
Default

Is it possible to access Performance by BarsInProgress or Instrument?
darckeen is offline  
Reply With Quote
Old 08-29-2009, 02:18 PM   #10
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

Hi darckeen, I don't think there is a specific overload to access Performance by BIP or Instrument, but I can think of a workaround.

You can use Trade class to get trade information and then match the instrument provided in the IExecutions information for entry/exit.

Anyways, I'll leave this open so Josh takes a look at it on Monday to confirm.
NinjaTrader_Austin is offline  
Reply With Quote
Old 08-31-2009, 07:07 AM   #11
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

Unfortunately there is no filtering to the BarsInProgress or instrument level.
NinjaTrader_Josh 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
Multi-time frame strategy laparker Strategy Development 4 05-24-2009 10:03 PM
Multi-time frame strategy - Longer-term real-time calculations Shansen Strategy Development 1 04-19-2009 06:36 AM
Multi-time frame: In which order are the Bars objects updated? noincomenojobnoassets Automated Trading 4 03-06-2009 09:10 AM
Multi Time Frame/Multi Instrument? GreenTrade Strategy Development 3 01-14-2008 02:24 PM
Multi-time frame scjohn Strategy Development 1 06-06-2007 07:20 PM


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