Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Account value and Cash Value at a time

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

    Account value and Cash Value at a time

    Hi NT,
    I am struggling finding Account value in NT.
    The strategy that I am coding, utilizes account value in order to calculate position size.

    I am using this function "Account.Get(AccountItem.CashValue, Currency.UsDollar)"

    However it is not working as expected!!! ( Returning same value throughout the backtest.)


    #2
    Hello dastaan,

    Thank you for your post.

    There is no Account when running a backtest and therefore Account.Get should not be used when backtesting a strategy. Instead, you could use variables to track a Cash Balance followed by using that to control how many "funds" your strategy can backtest though.

    Additionally, you may get information about your trades using the Trade object. Please see the help guide link below for more information.

    Trade - https://ninjatrader.com/support/help.../nt8/trade.htm

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,

      I see that this is a work around, However I am looking for a Generic solution which works the same on backtesting and live deployment.

      Do you think there is a way to do so ?

      Comment


        #4
        Hello dastaan,

        Thank you for your note.

        Something you could do is use IsInStrategyAnalyzer to determine if the strategy is running in the Strategy Analyzer. When the strategy is running in the strategy analyzer, you could pull the initial value from the Account and store that value into a variable. Then you would use that variable throughout the Strategy Analyzer run as suggested in post #2. Otherwise, when the strategy is not running in the Strategy Analyzer your logic could use Account.Get as described in post #1.

        IsInStrategyAnalyzer - https://ninjatrader.com/support/help...egyanalyer.htm

        Please let us know if we may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X