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 access user defined inuts in initialize function.

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

    How to access user defined inuts in initialize function.

    I wish to take a list of instruments from user defined inputs and add
    the bar information that coresponds to those inputs using the initialize function. However, whenever I do this the code compiles, but can not be loaded.
    Please point me in the right direction.
    Thx.

    protectedoverridevoid Initialize()
    {
    Add(INST2,PeriodType.Minute,
    1);
    Add(
    "MSFT",PeriodType.Minute,1);
    CalculateOnBarClose =
    false;

    }

    INST2 is the string name of the instrument i wish to add bars for.

    #2
    Hi oblix,

    What do you have for code in the Variables and Properties regions of your code in terms of this INST2 variable?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I tested these and they work until i try to access them inside initialize

      #region Variables
      // Wizard generated variables
      bool b_Initialized = false;
      privatestring iNST1 = @"Empty"; // Default setting for INST1
      privatestring iNST2 = @"Empty"; // Default setting for INST2

      #region Properties
      [Description(
      "Enter Instrument Symbol 1")]
      [Category(
      "Parameters")]
      publicstring INST1
      {
      get { return iNST1; }
      set { iNST1 = value; }
      }

      [Description(
      "Enter Instrument Symbol 2")]
      [Category(
      "Parameters")]
      publicstring INST2
      {
      get { return iNST2; }
      set { iNST2 = value; }
      }

      Comment


        #4
        I see. Unfortunately you cannot "dynamically" add instruments from a user defined input. You will have to hard code them in.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, Yesterday, 02:04 AM
        1 response
        15 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by agclub, 04-21-2024, 08:57 PM
        4 responses
        18 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Irukandji, Today, 04:58 AM
        0 responses
        3 views
        0 likes
        Last Post Irukandji  
        Started by fitspressoburnfat, Today, 04:25 AM
        0 responses
        2 views
        0 likes
        Last Post fitspressoburnfat  
        Started by Skifree, Today, 03:41 AM
        1 response
        5 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Working...
        X