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 dappa, Today, 09:18 AM
      0 responses
      0 views
      0 likes
      Last Post dappa
      by dappa
       
      Started by bill2023, Yesterday, 08:51 AM
      4 responses
      22 views
      0 likes
      Last Post bltdavid  
      Started by trilliantrader, Today, 08:16 AM
      3 responses
      9 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
      79 responses
      19,662 views
      5 likes
      Last Post zrobfrank  
      Started by funk10101, Today, 08:14 AM
      3 responses
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X