![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jun 2006
Location: , ,
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
See this thread - http://ninjatrader.mywowbb.com/forum3/1774.html
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2006
Location: , ,
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
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.
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|