![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2011
Posts: 30
Thanks: 4
Thanked 1 time in 1 post
|
Hi guys,
I'm going to trade some of my automated strategies in realtime, buy I have to understrand some values of GetAccountValue first. So please let me understand what is the proper way to use it to be able to apply money management to my strategies to get things work. I will use this simple example for better understand. Let's have account with size of $10 000 and let's go trade two futures instruments say FOO and BAR with same initial margins $1 000. Also let's have 2 strategies trading this instruments with actual state:
And the questions:
Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
dalisdj,
Unfortunately the MasterInstrument.Margin is unsupported code, however note that this MasterInstrument object is what is defined by your instrument manager. GetAccountValue(AccountItem.CashValue) would work to get the account value. Strategies are separate in all PnL calculation, so the RealizedProfitLoss is only from the strategy you are calling it from. You can read more about this here : http://www.ninjatrader.com/support/h..._account_p.htm GetAccountValue(AccountItem.CashValue) would return the realized account value here, but please note it only works on realtime data. Using CalculationMode.Price it would be the actual price of the stop loss you wanted, so something like : Close[0]*(1 - 0.01) should work. Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2011
Posts: 30
Thanks: 4
Thanked 1 time in 1 post
|
Hi AdamP,
thanks for your support. It helped me in most issues, but I'm still not sure about available account money. Let's say I have $10 000 account and active trades at total margin of $3 000. This means that I have available only maximum price of $7 000 to enter another trade, because size of $3 000 is blocked by my broker. So do I have to manage my strategies by my own to get available part of my account (in this case $7 000) if any position active? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,199
Thanks: 135
Thanked 182 times in 181 posts
|
Hello dalisdj,
That will depend on what your brokerage account supports. Some brokerage technology does not provide the buying power or the cash value. http://www.ninjatrader.com/support/f...ead.php?t=5474 So if you call GetAccountValue() on a supported information you will not need to manually calculate it. Otherwise, you would have to calculate this or manage this separately. Let us know if we can be of further assistance.
JC
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2011
Posts: 30
Thanks: 4
Thanked 1 time in 1 post
|
Hi AdamP,
you still didn't answer to my question, but otherwise you let me know about really important issue of account value support. I didn't know about different support of each values and I see that my broker ZenFire support only two values, which should cause a problem in future. So thanks a lot you point me this. I would like to generalize my questlion: What is the difference between CashValue and TotalCashBalance? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi dalisdj.
TotalCashBalance is not supported. Possible supported values of this are: AccountItem.BuyingPower AccountItem.CashValue AccountItem.RealizedProfitLoss More info here for GetAccountValue() http://www.ninjatrader.com/support/h...countvalue.htm
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| getaccountvalue, masterinstrument |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GetAccountValue | guillembm | Miscellaneous Support | 6 | 12-11-2011 07:04 PM |
| MasterInstrument.Margin and MasterInstrument.Margin2 | freewind | General Programming | 4 | 12-27-2010 06:42 AM |
| testing the GetAccountValue() method | drolles | Strategy Development | 7 | 12-21-2010 09:41 AM |
| GetAccountValue on Sim101 | MXASJ | Version 7 Beta General Questions & Bug Reports | 15 | 06-21-2010 09:42 AM |
| GetAccountValue | ATI user | Version 7 Beta General Questions & Bug Reports | 5 | 10-25-2009 08:41 AM |