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

Private double - how to set default value for more variables at once

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

    Private double - how to set default value for more variables at once

    Hello,

    I have tried all possible resources and did not find answer to the following issue:

    - I have 8 private double variables
    - In protected override void Initialize() I set value of 0 for all of them

    QUESTION: When I get into IF ELSE statement how will I be able to call the value of 0 for all the private double variables at once (without having to copy the whole 8 lines)

    I will appreciate any guidance


    #2
    My apologies to the moderator. This thread was meant to belong into "NinjaTrader 7 - Indicator Development". If possible, please move the thread there.

    Comment


      #3
      It helps if you post text rather than a pic so people can copy/paste for you.

      Just move the variable initialization into a new method:

      Code:
      private void InitializePrvni() {
             firstVariable = 0;
             secondVariable = 0;
      
      }

      then from your Initialize method and from your OnBarUpdate you can just call

      Code:
      InitializePrvni()
      Last edited by kevinenergy; 02-22-2019, 04:11 AM.

      Comment


        #4
        Thank you very much Kevin

        Comment


          #5
          Hello kadan,

          Thanks for your post.

          It looks like you have resolved this item following kevenenergy's input.

          I'll have this thread moved to the NinjaTrader 7 forum for better searching.

          If you have any additional NinjaScript related questions, please do not hesitate to open a new thread.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,403 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          95 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          7 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          159 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          8 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X