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 selu72, Today, 02:01 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by WHICKED, Today, 02:02 PM
        2 responses
        10 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        21 views
        0 likes
        Last Post f.saeidi  
        Started by Mikey_, 03-23-2024, 05:59 PM
        3 responses
        51 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X