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 Carolscogginsi, Yesterday, 10:45 PM
    0 responses
    6 views
    0 likes
    Last Post Carolscogginsi  
    Started by RaddiFX, Yesterday, 10:15 AM
    2 responses
    15 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by patrickmlee007, Yesterday, 09:33 AM
    2 responses
    18 views
    0 likes
    Last Post patrickmlee007  
    Started by magnatauren, 08-15-2020, 02:12 PM
    5 responses
    208 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by rene69851, 05-02-2024, 03:25 PM
    1 response
    23 views
    0 likes
    Last Post rene69851  
    Working...
    X