![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
The following code;
protectedoverridevoid Initialize() { BPer= BarsPeriod.Value; Add(PeriodType.Minute,90); CalculateOnBarClose = true; InstrumentName=(Instrument.MasterInstrument.Name[1].ToString()); BValue= (BarsPeriods[1].Id.ToString()) ; Print (BValue); Print (BPer); Print (InstrumentName); } Yields the following results on a GBPUSD 30 minute chart; Minute 30 B Minute 30 Q The 'Minute' and '30' are correct. Why are 'B' and 'Q' being returned? I am expecting 'GBPUSD' If I use InstrumentName=(Instrument.FullName[0].ToString()); I get the same type of results for InstrumentName. I checked the ref mat'l that I found referenced on the forum. I believe I did what was indicated on the forum. Thank you, Duke |
|
|
|
|
|
#2 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,185
Thanks: 178
Thanked 301 times in 259 posts
|
Instrument.FullName[1].ToString() ?
Quote:
|
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
Upon more research ---
When I omit the secondary chart ( // Add(PeriodType.Minute,90) And use --- InstrumentName=(Instrument.FullName.ToString()); Print (InstrumentName); I get-- $GBPUSD ---good NQ 03-12 ---??? Why are two instruments returned? |
|
|
|
|
|
#4 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,185
Thanks: 178
Thanked 301 times in 259 posts
|
Quote:
Code:
Print ("InstrumentName3="+Instrument.FullName[0].ToString()+
Instrument.FullName[1].ToString()+
Instrument.FullName[2].ToString()+
Instrument.FullName[3].ToString()+
Instrument.FullName[4].ToString()+
Instrument.FullName[5].ToString()
);
Print ("InstrumentName4="+Instrument.FullName.ToString() );
HTML Code:
Output: InstrumentName3=ES 09- InstrumentName4=ES 09-12 |
|
|
|
|
|
|
#5 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,185
Thanks: 178
Thanked 301 times in 259 posts
|
Quote:
How many data series are in your chart? Right click the chart, Data Series , and on lower left corner. You might have $GBPUSD and then NQ 03-12. If NQ 03-12 is there, try to remove it. If you can't, Create a new chart for $GBPUSD. good luck |
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Mar 2012
Posts: 102
Thanks: 29
Thanked 4 times in 4 posts
|
This behavior is peculiar to the strategy tester. Before I go to the strategy tester, I open the output box and discover the reference to NQ. I then delete this from the output box, run the tester. Everything is fine. I had assumed that it was being placed in the output box as a result of the actual testing. Not so. It appears to be a wierd type of behavior that has nothing to do with the testing and is placed there before the testing.
|
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
dukeb,
Do you perhaps have a toy example strategy I can use to verify this? I would also need to have replication steps.
Adam P.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to determine if SMA is moving up or down | krakken | Automated Trading | 4 | 08-09-2011 06:59 PM |
| How to determine if Optimizer stuck? | sajosh | Strategy Analyzer | 9 | 07-21-2011 02:59 PM |
| Determine if using 64bit | bobcat70 | Miscellaneous Support | 1 | 09-14-2010 11:33 PM |
| How to determine whether an instrument is dealable or not | Buthus | Strategy Development | 7 | 11-06-2009 06:30 AM |
| Easy way to determine last bar? | terenyi | General Programming | 2 | 09-08-2008 03:44 PM |