NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 04-02-2007, 08:08 AM   #1
Json
Member
 
Join Date: Jun 2006
Location: , ,
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Is there an accessible property to return REAL account positions within a NinjaScript Strategy?

The value I'm looking for is the same as displayed in the SuperDom.



Json

Json is offline  
Reply With Quote
Old 04-02-2007, 08:24 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

See this thread - http://ninjatrader.mywowbb.com/forum3/1774.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-02-2007, 03:50 PM   #3
Json
Member
 
Join Date: Jun 2006
Location: , ,
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Tried -

Cbi.Position myPosition = Account.Positions.FindByInstrument(Instrument);
if (myPosition != null)
Print(myPosition.Quantity);
else
Print("There is no position");

Log Showed -

Error on calling 'OnBarUpdate' method for strategy 'Test': Object reference not set to an instance of an object.
Json is offline  
Reply With Quote
Old 04-02-2007, 04:47 PM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Post imported post

I just applied the code lines below to a blank sample strategy no problem. -> The issue you experienced likely is related to something different.

Please try finding the cause by (a) eliminating the other code from your strategu or (b) building a new startegy, coping code below first and then adding you other custom code step by step.
NinjaTrader_Dierk 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


All times are GMT -6. The time now is 09:44 PM.