Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    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.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Barry Milan, Yesterday, 10:35 PM
        5 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        13 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        12 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        8 views
        0 likes
        Last Post nandhumca  
        Working...
        X