• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AccountItem.CashValue question

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

    AccountItem.CashValue question

    Regarding Account.Get(AccountItem.CashValue, Currency.Euro)

    Say I am using Sim1 account denominated in Euro

    Account.Get(AccountItem.CashValue, Currency.Euro)
    Account.Get(AccountItem.CashValue, Currency.UsDollar)

    I noticed that these two calls return the same value which is the $ value It seems like the second parameter does not affect anything

    Is that expected?

    #2
    Hello onb1,

    Thank you for your note.

    The case example I can find in the help guide of using Currency.UsDollar or Currency.Euro is in reference to checking the master instrument, for example at the following link,
    https://ninjatrader.com/support/help...t_currency.htm

    I would not expect using Currency.Euro would convert your account balance to euros, as this would suggest the parameter would pull live currency data rather than just be used to compare the instruments FX.

    If you see a case in the helpguide or a sample which suggests this would convert the account balance, please let us know.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      I would not expect using Currency.Euro would convert your account balance to euros, as this would suggest the parameter would pull live currency data rather than just be used to compare the instruments FX.
      Agree, I don't expect to see that either.

      My question is this
      The call to Get has two inputs - the item and currency. I could not find any explanation why the second parameter is needed and what is it used for. Thought you might be able to shed light on that.

      Account.Get(AccountItem.CashValue, Currency.Euro)

      Comment


        #4
        Hello onnb1,

        This is not documented. What is it you are trying to accomplish exactly?

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          We are position sizing based on account cash value.
          As you noted, we need to convert a set risk that is in the account currency to the currency pair traded in order to calculate the position size for the market traded.

          When working with the Get api, I noticed that the second parameter is there but doesn't do anything. I wanted to confirm this

          Comment


            #6
            Hello onnb1,

            I wrote a sample which would be pretty easy to modify so that it converts the account size to another currency. You would need to adjust xAccountSize by euros.

            Please see attached.

            Please let us know if you have any questions.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Alan,

              Is there no way to get the Total PnL without having to keep track of it myself in the OnPositionUpdate() method?

              I am expecting something like:

              Code:
              PositionAccount.GetTotalProfitLoss(PerformanceUnit.Currency, Price);
              But I haven't seen anything like this.

              I would like to get the value described in this documentation under "Understanding Accounts Tab --> Total Pnl":

              https://ninjatrader.com/support/help..._reference.htm

              The issue is that my base class cannot derive from the strategy class, and thus I cannot (and shouldn't have to) override the OnPositionUpdate() method. Please let me know if there is a NinjaScriptBase object that contains the account details I'm looking for.

              Comment


                #8
                Hello jflaggs,

                The sample I provided includes what you’re looking for if you do not enable the backtest bool.

                I would also suggest downloading the addon at the following link, Addon Framework for how to get PL outside of a strategy.

                https://ninjatrader.com/support/help...t_overview.htm

                Please let us know if you need further assistance.
                Alan P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jayfutures23, Today, 09:32 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by ilai74, Today, 09:43 AM
                0 responses
                2 views
                0 likes
                Last Post ilai74
                by ilai74
                 
                Started by dshalom9, Today, 08:36 AM
                9 responses
                17 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by stock_wizard_49, 07-11-2020, 06:57 PM
                1 response
                16 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by asmmbillah, Yesterday, 03:03 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X