![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
darckeen,
You will need to swap your bars to have primary as the larger time frame series.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
|
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?
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Feb 2009
Posts: 177
Thanks: 0
Thanked 0 times in 0 posts
|
Is it possible to access Performance by BarsInProgress or Instrument?
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
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.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Unfortunately there is no filtering to the BarsInProgress or instrument level.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |