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 > Miscellaneous Support > Historical Version 7 Beta Threads > Version 7 Beta General Questions & Bug Reports

Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports.

 
 
Thread Tools Display Modes
Old 03-01-2010, 12:28 AM   #1
MXASJ
Senior Member
 
Join Date: May 2009
Location: Asia
Posts: 304
Thanks: 0
Thanked 9 times in 5 posts
Default Multi Instrument and Indicator on Indicator in a Strategy

Hi Ninja Team,

I'm trying to add an indicator to a strategy chart that uses the second data series (BarsArray[1]) as an input, and then trying to add an indicator that uses THAT indicator as an input. Here is an example:

PHP Code:
// Variables
 
private string myInstrument = @"SPY"
 
protected 
override void Initialize()
{
CalculateOnBarClose true;
Add(myInstrument,BarsPeriod.IdBarsPeriod.Value);//Adds another bar series to the strategy... BarsArray[1]
 
//This Complies, but throws an error 'BarsArray property can not be accessed from within 'Initialize' method 
Add(SMA(BarsArray[1], 14));//Adds an SMA plot to the chart from BarsArray[1] instrument
 
//This is not OK
//Add(SMA((myInstrument,BarsPeriod.Id, BarsPeriod.Value), 14));
 
//This is not OK
//Add (SMA(myInstrument, 14));
 
//Indicator on Indicator. This compiles, but throws the error
//Add (EMA((SMA(BarsArray[1], 14)), 14));
 
 
}
 
 
protected 
override void OnBarUpdate()
{
//Do something

What's the best way for me to accomplish this? Thanks.
MXASJ is offline  
Old 03-01-2010, 10:29 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

MXASJ,

BarsArray does not exist in Initialize(). You will want to use StrategyPlot techniques to achieve what you want.
NinjaTrader_Josh is offline  
 

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-instrument indicator - daily bar sync issues. kdoren Version 7 Beta General Questions & Bug Reports 4 12-09-2009 08:39 AM
Indicator on Multi-Instrument Indicator kdoren Version 7 Beta General Questions & Bug Reports 2 11-11-2009 06:13 PM
Multi - instrument indicator. Czarek Indicator Development 1 08-17-2009 07:10 AM
Multi Instrument Indicator Request duck_CA Indicator Development 4 12-14-2008 11:49 AM
Is it possible to write a multi-instrument indicator? CraigC Indicator Development 3 06-18-2008 01:55 AM


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