NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 04-27-2011, 03:52 PM   #1
texasnomad
Senior Member
 
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 9
Thanked 2 times in 2 posts
Default Reading instrument name

I'm trying to simulate a tick by tick strategy. I added the following lines in Initialize():

Code:
 Add("EURUSD",PeriodType.Tick,1,MarketDataType.Bid);   
   Add("EURUSD",PeriodType.Tick,1,MarketDataType.Ask);
This doesn't work for testing as I don't wish to hard code the instrument. Ideally, I would like to look it up programmatically

http://www.ninjatrader.com/support/h...sterinstrument.

The docs for MasterInstrument say that MasterInstrument.Name should not be calling in Initialize(). Is there another method or property that can supply the Instrument name of the main chart within Initialize()?
texasnomad is offline  
Reply With Quote
Old 04-27-2011, 04:14 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi texasnomad,

Currently hard coding the instrument is only solution for now. We have this suggestion tracked with ID # 916, to allow bid / ask series Add() overload that doesn't require instrument specification.

You can see this thread for a recent discussion on this and some work-arounds proposed:
http://www.ninjatrader.com/support/f...988#post215988
Last edited by NinjaTrader_RyanM; 04-27-2011 at 04:29 PM.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 04-27-2011, 04:26 PM   #3
texasnomad
Senior Member
 
Join Date: Oct 2008
Location: Dallas, TX
Posts: 120
Thanks: 9
Thanked 2 times in 2 posts
Default

Thanks for the link. Instrument.FullName successfully replaces the hard coded string.
texasnomad 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
reading this forum stricom123 Miscellaneous Support 2 11-01-2009 11:52 AM
Reading Account information gator-trader Miscellaneous Support 1 08-22-2009 01:19 PM
Reading from an Indicator moflaherty Strategy Development 8 07-30-2009 11:57 AM
Reading Name of Script? BillCh General Programming 9 04-09-2009 04:10 AM
Reading other price data fishbed Indicator Development 1 01-18-2008 11:57 AM


All times are GMT -6. The time now is 08:53 PM.