Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue in Geting Account Cash Value

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

    Issue in Geting Account Cash Value

    Hi,

    I am using this function to get account cash value

    GetAccountValue(AccountItem.CashValue);

    This give correct value when I test my strategy on simulated data but when I test my strategy on historical data for backtesting it gives zero for cash value.Please tell me why this function gives zero value in backtesting on historical data.

    Thanks,
    Irfan

    #2
    Hi Rana.irfan,

    Thank you for your post.

    GetAccountValue() only works on real time data, not historical which is why you are getting a 0 value.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thanks,

      So which function i can use to get account cash value on Historical data.

      Comment


        #4
        Rana.irfan,

        There isn't a function since the backtest doesn't have a cash value.
        However, you can create a script in the strategy that you can use to track an account that you would create in the code, basically a variable and you would calculate the PnL through the Strategy Performance.

        Strategy Performance in NinjaScript
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        64 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Working...
        X