• 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

Code from F1 Help screen doesn't work

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

    Code from F1 Help screen doesn't work

    I copy and pasted the following code...(from NinjaTrader7 Help)....and it will not compile.

    protected override void OnBarUpdate()
    {
    // Checks to see if the account has more than $25000
    if (GetAccountValue(AccountItem.CashValue) > 25000)
    {
    // Do something;
    Print ("found the cash value");

    }


    }

    I get the error message......
    "The name 'GetAccountValue' does not exist in the current context.....

    This seems simple enough...not sure why it isn't working..

    #2
    Hello Andrew56,

    Thank you for your post.

    Was this thrown in an Indicator or Strategy?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Indicator...(I use Chart trader and it doesn't like strategies)

      Comment


        #4
        Andrew56,

        You won't be able to use GetAccountValue() as this is part of the Strategies Base and not accessible from the Indicator.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by traderpards, 12-12-2018, 01:15 PM
        5 responses
        152 views
        0 likes
        Last Post BrianL
        by BrianL
         
        Started by Cyanez, Today, 08:41 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by TonyParisi, Today, 07:38 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by tgn55, 09-24-2019, 06:34 AM
        13 responses
        49 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by jasphere, Today, 07:37 AM
        4 responses
        20 views
        0 likes
        Last Post jasphere  
        Working...
        X