Announcement

Collapse
No announcement yet.

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 ariellewaldman099, Today, 03:55 PM
          0 responses
          4 views
          0 likes
          Last Post ariellewaldman099  
          Started by Waxavi, Today, 03:39 PM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by Waxavi, Today, 03:09 PM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by iceman2018, Today, 01:44 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by samish18, 10-27-2024, 05:48 PM
          10 responses
          152 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X