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

Referencing Price Series

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

    Referencing Price Series

    Hi,

    I am trying to use the price series Open and Close from a different namespace. I keep getting a compile errors stating:

    The name 'Open' does not exist in the current context.
    The name 'Close' does not exist in the current context.

    What is the fully qualified name for these price series so that I may use them outside the indicator class?

    #2
    Hello Zeos6,

    The open and close series would need to come from a script.

    I would recommend you pass the instance of the script and use the series from the variable that holds the instance of the script.

    Print(myIndicator().Close[0]);

    I have an example that passes an instance of a script to an addon.


    If you are trying to get a series without an instance of a script constructing the series for you, you will not be able to do so. Instead use a BarsRequest to query for bar data.

    Below is a public link to the help guide on BarsRequest.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks, ChelseaB.

      The instance approach worked like a charm. Exactly what I needed. Appreciate it.
      Had to make a minor adjustment though: myIndicator.Close[0] rather than myIndicator().Close[0].
      Thank you ChelseaB.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      4 responses
      23 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Brevo, Today, 01:45 AM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by rjbtrade1, 11-30-2023, 04:38 PM
      2 responses
      74 views
      0 likes
      Last Post DavidHP
      by DavidHP
       
      Started by suroot, 04-10-2017, 02:18 AM
      5 responses
      3,021 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Stanfillirenfro, Today, 07:23 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X