Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

GetAccountValue = 0 Why?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    GetAccountValue = 0 Why?

    Hi,

    Trying this Get Account call in a few places, but always returning zero.

    I've read that it returns 0 for historical, so how do i get it to look at current?

    protected override void OnBarUpdate()
    {

    Print(GetAccountValue(AccountItem.CashValue));


    **************************
    Output window is zero. I also have this inside my "if" statement that decides to take a trade, but zero there as well.

    Can anyone point out what i'm doing wrong?

    Cheers

    #2
    Originally posted by Aussiemike View Post
    Hi,

    Trying this Get Account call in a few places, but always returning zero.

    I've read that it returns 0 for historical, so how do i get it to look at current?

    protected override void OnBarUpdate()
    {

    Print(GetAccountValue(AccountItem.CashValue));


    **************************
    Output window is zero. I also have this inside my "if" statement that decides to take a trade, but zero there as well.

    Can anyone point out what i'm doing wrong?

    Cheers
    That function only returns a value if you are running realtime. There is no workaround for using it in historical backtest or any kind of situation that is using historical data only.

    Comment


      #3
      Thanks again.

      That's a shame they have nothing for backtesting...

      I've found a money management example someone posted so i'll have to tweak that to get something working

      Cheers

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Richozzy38, Yesterday, 01:06 PM
      6 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by alifarahani, 04-19-2024, 09:40 AM
      10 responses
      74 views
      0 likes
      Last Post alifarahani  
      Started by Zeezee, Today, 12:45 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by tomasak, Today, 12:54 PM
      0 responses
      1 view
      0 likes
      Last Post tomasak
      by tomasak
       
      Started by swjake, Today, 12:04 PM
      2 responses
      10 views
      0 likes
      Last Post swjake
      by swjake
       
      Working...
      X