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 Barry Milan, Yesterday, 10:35 PM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Started by DJ888, 04-16-2024, 06:09 PM
      4 responses
      13 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by terofs, Today, 04:18 PM
      0 responses
      12 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by nandhumca, Today, 03:41 PM
      0 responses
      8 views
      0 likes
      Last Post nandhumca  
      Working...
      X