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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        388 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        260 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        218 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        302 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        268 views
        0 likes
        Last Post CarlTrading  
        Working...
        X