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

How to add own class

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

    How to add own class

    Hello Ninja Scripters,

    I guess, this should be a simple questions for most of you guys, yet find no answer to this.
    I hope someone out there might help me and give me a short answer. I'd be quite thankful.

    I want to create a custom Indicator. Yet, when I create my own Class under the namespace:
    NinjaTrader.NinjaScript.Indicators .... why can't I use the piece of Information like the: Bars.GetHigh?

    the "Using" includes the: NinjaTrader.Data ... which, I thought, gives access to the Bars information, yet why can't I enter this Bars information?
    The Ninja Script Help Guide says that you can't just use, for example, "High[2]" out of the OnBarUpdate-EventHandler, you need to use the Bars.GetHigh() Method,
    but it doesn't work. So How can I access the Bars Data Information when using my own class?



    #2
    Welcome to the forums Sebastian Leitner!

    Bars is provided from the indicator base class.

    If you want to access Bars (or other properties from the host class) from a custom class, I suggest creating a NinjaScriptBase parameter for your class's constructor so you can access properties from within your custom class.

    Please see the attached example.

    Let us know if you have any questions.
    Attached Files
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ezekilany, Today, 01:10 AM
    0 responses
    3 views
    0 likes
    Last Post ezekilany  
    Started by usjavaburn, Today, 12:59 AM
    0 responses
    3 views
    0 likes
    Last Post usjavaburn  
    Started by heatherjmarshalls, Today, 12:56 AM
    0 responses
    2 views
    0 likes
    Last Post heatherjmarshalls  
    Started by Nicholewatkinsi, Yesterday, 10:53 PM
    0 responses
    6 views
    0 likes
    Last Post Nicholewatkinsi  
    Started by dward123, 01-02-2024, 09:59 PM
    4 responses
    176 views
    0 likes
    Last Post Lancer
    by Lancer
     
    Working...
    X