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

Not working on indicator

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

    Not working on indicator

    if(!Historical)
    {
    foreach (Account acct in Cbi.Globals.Accounts)
    {
    Print("--------------------------------------");
    Print("acct: " +acct.Name);
    Print("acct: " +acct.GetAccountValue(AccountItem.CashValue, Currency.UsDollar));
    Print("--------------------------------------");
    }
    }

    This code doesn't work on indicator. The output is always $0.00. Someone could help me to get the account value of account where the indicator is running. For example, if the account in the chart trader is sim101 then I want that my indicator will output a cash value of sim101 account.

    #2
    Hello,

    Thank you for the question.

    This syntax would be similar to this post: http://ninjatrader.com/support/forum...ad.php?t=55718

    this is for a strategy so this would not work in an indicator specifically and is also unsupported. In general indicators are not able to access account information.

    You could try an unsupported solution that was provided in another post: http://ninjatrader.com/support/forum...ad.php?t=76151

    As with any un supported code, this may or may not work for your situation so it would be something you need to test.

    The only supported way to do this would be to provide the account information to an indicator using a strategy and have the indication plot the values provided.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      This syntax GetAccountValue(AccountItem.CashValue) works on non-historical in strategy and I want the same thing in my indicator. Can the indicator calls a strategy? If indicator can do that then please give me an example on it.

      Comment


        #4
        Hello,

        The method GetAccountValue is meant for the strategy base only, this was not included in Indicators intentionally.

        There is no supported way to access account information directly from an indicator. In general indicators are meant for plotting and other analysis work, you can provide account information to an indicator from a strategy but not the other way around and not just from the indicator its self.

        The only supported way would be a strategy providing this information to the indicator. For what you are trying to do this would be something that may or may not work using the unsupported code available on the forum. In general this is not a supported item for Indicators though.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kaledus, Today, 01:29 PM
        3 responses
        9 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by frankthearm, Yesterday, 09:08 AM
        14 responses
        47 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by gentlebenthebear, Today, 01:30 AM
        2 responses
        13 views
        0 likes
        Last Post gentlebenthebear  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        17 views
        0 likes
        Last Post PaulMohn  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        2 responses
        56 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Working...
        X