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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        56 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        160 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        96 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X