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

Variables & Scope

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

    Variables & Scope

    What are the recommended ways to define variables in NinjaScript so they can be seen by say

    protected override void OnBarUpdate()

    and

    private int myMethod()?
    Attached Files

    #2
    Just as you see in your attached code will work fine (myInt).

    Dan
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Hello futurenets,

      Thank you for your post and welcome to the NinjaTrader Support Forum!

      Dan is correct here. You may also wish to view the video at the following link: https://www.youtube.com/watch?v=JZpo01eSO9c

      Comment


        #4
        ok thanks.

        I'd also like to give my methods access to plots and Time[0], Close[0] etc. do I need to pass these as parameters (any samples?)

        BTW this is a great product!

        Comment


          #5
          Originally posted by futurenets View Post
          ok thanks.

          I'd also like to give my methods access to plots and Time[0], Close[0] etc. do I need to pass these as parameters (any samples?)

          BTW this is a great product!
          Those are Interface objects defined in the IndicatorBase. They are, therefore, already accessible from anything that inherits from the IndicatorBase class.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lorem, Yesterday, 09:18 AM
          4 responses
          14 views
          0 likes
          Last Post lorem
          by lorem
           
          Started by Spiderbird, Today, 12:15 PM
          0 responses
          5 views
          0 likes
          Last Post Spiderbird  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          12 responses
          42 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by FrazMann, Today, 11:21 AM
          0 responses
          6 views
          0 likes
          Last Post FrazMann  
          Started by geddyisodin, Yesterday, 05:20 AM
          8 responses
          52 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X