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 06-28-2010, 11:10 PM   #1
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Unhappy initiating a strategy

i have a strategy which i launch from the chart..it currently process instruments which i imported over(20 symbols)..if the chart is loaded on an instrument, will the strategy process all the 20 symbols? or does a chart have to be open for each instrument for the strategy to work? I have a strategy with 20 symbols on a daily chart of BAC...one of the symbols is XLI, which i imported over. But when i try to bring up XLI on another chart, it is blank. would it be better to run the strategy from the TAB and not from the CHART? using multiple symbols?
mystiq is offline  
Reply With Quote
Old 06-29-2010, 03:19 AM   #2
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

mystiq, already replied in your other thread on the topic - if you created a multiinstrument strategy and added your 20 symbols in it's code to be loaded, it would maintain the data needed if you just start it on your primary chart -

http://www.ninjatrader-support.com/H...struments.html

Please note that those symbols will then not appear on a chart automatically with this procedure, they are just available 'in the back' to run calculations on.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-29-2010, 04:48 AM   #3
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
mystiq, already replied in your other thread on the topic - if you created a multiinstrument strategy and added your 20 symbols in it's code to be loaded, it would maintain the data needed if you just start it on your primary chart -

http://www.ninjatrader-support.com/H...struments.html

Please note that those symbols will then not appear on a chart automatically with this procedure, they are just available 'in the back' to run calculations on.
thx you again. i was thinking that the strategy was not working because i could not see the chart. so i am thinking of using "min bars required" of 1 ...with 1 day of historical data needed...could this work? and thx for responding to my other posts. next time i will wait before posting again.
mystiq is offline  
Reply With Quote
Old 06-29-2010, 04:59 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

You're welcome, sounds good - I could not comment on how much your strategy would need historical data wise to initialize properly as needed, so normally you want to load more days than 1 - please note that the MinBarsRequired is not how many days are loaded - this will be set as you create the chart (daysToLoad).
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-08-2010, 02:36 AM   #5
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Question initiating a strategy

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
You're welcome, sounds good - I could not comment on how much your strategy would need historical data wise to initialize properly as needed, so normally you want to load more days than 1 - please note that the MinBarsRequired is not how many days are loaded - this will be set as you create the chart (daysToLoad).

mystiq, already replied in your other thread on the topic - if you created a multiinstrument strategy and added your 20 symbols in it's code to be loaded, it would maintain the data needed if you just start it on your primary chart -

You're welcome - if you add the strategy to your chart it would trigger a data load if needed. As an alternative you could also just open up a standalone chart of the symbol in question to trigger a backfill (if you're connected to a feed supporting this).

mystiq, for this strategy to work you would need to add them in the strategy directly - as you then start it from your primary chart it would load / add the other bars objects as needed -
Thx for the info NT_Bertrand:

...if i am running a multi-instrument strategy that alerts on a 30min BAC chart,...which has 20 instruments already coded in strategy, and one instrument is IBM, would the strategy alert me to IBM if conditions are met? or do i have to open another 30min chart just for each instrument?
mystiq is offline  
Reply With Quote
Old 07-08-2010, 03:29 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

You would not have to open a chart for each instrument - however the conditions for the alert have to be coded to use the IBM price series -

http://www.ninjatrader-support.com/H...struments.html

You can see example code how to start under the 'True Event Driven OnBarUpdate() Method' section.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 07-08-2010, 03:38 AM   #7
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Question initiating a strategy

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
You would not have to open a chart for each instrument - however the conditions for the alert have to be coded to use the IBM price series -

http://www.ninjatrader-support.com/H...struments.html

You can see example code how to start under the 'True Event Driven OnBarUpdate() Method' section.
thank you NT_Bertrand , but i still do not understand - "the conditions for the alert have to be coded to use the IBM price series" - i referenced the info above , but cannot understand what it means. please explain to a newbie....

edit: the extra instruments are not HARD CODED within strategy, but manually added as a parameter (?soft coded?) will your explaination still apply?
Last edited by mystiq; 07-08-2010 at 03:42 AM. Reason: add info
mystiq is offline  
Reply With Quote
Old 07-08-2010, 04:23 AM   #8
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

mystiq, the symobls you want to use in your strategy are added with the Add() command in the Initialize(), you can then either access them in the right BarsInProgress context (check with of your bars objects is calling the OnBarUpdate to do calculations) or you can access this instruments data via the BarsArray property, so you can decide which input series your indicator / calculations should use, for example consider an SMA(BarsArray[1], 20) would give you the 20 Period SMA on the first added / the secondary instrument in your strategy.

If you take some time and review our SampleMultiInstrument strategy installed per default with NinjaTrader it should become clearer and clearer how this environment is designed.
NinjaTrader_Bertrand 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
Initiating ATM Strategies in a NinjaScript daven Automated Trading 7 08-18-2010 10:47 PM
Initiating trade from within Indicator seanhughes16 Automated Trading 2 04-07-2010 11:32 PM
Error initiating strategy POINTERDOG ATM Strategies (Discretionary Trading) 3 08-14-2009 09:48 PM
Delay initiating exit-on-close order on IB tooearly Automated Trading 2 07-30-2009 08:26 AM


All times are GMT -6. The time now is 06:25 PM.