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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X