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

User Variable Inputs?

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

    User Variable Inputs?

    I am looking to create a strategy in the Strategy Wizard that uses the User Variables. Specifically I would like the strategy to operate the same every day except that daily, before I load the strategy, I will right click on the strategy and input user variables. This is of course found on the Control Panel/Strategy Tab.

    I know that are videos out there they show how to set up User Variables but for the life of me, I cannot find them either in the Forum or on YouTube. Can someone please enlighten me? Thanks!

    Best regards,

    Dolfan

    PS I am not opposed to unlocking the code if necessary.

    #2
    Hello Dolfan, and thank you for your question.

    You set these kinds of inputs in the User Defined Inputs page, as pictured in the attached mycoolsetting.png . If you made those settings yourself and then clicked "View Code" , and did a search for mycoolsetting , you would find the following :

    Code:
    [FONT=Courier New]        #region Variables
            // Wizard generated variables
    
    [B]        private string myCoolSetting = @"very cool"; // Default setting for MyCoolSetting
    
    [/B]        // User defined variables (add any user defined variables below)
            #endregion
    
    // ...
    
            #region Properties
       [Description("frosty")]
    
    [B]        [GridCategory("Parameters")]
    
    [/B]        public string [B]MyCoolSetting[/B]
            {
                get { return myCoolSetting; }
                set { myCoolSetting = value; }
            }
            #endregion
    [/FONT]
    Going over the three bolded lines in more detail, we find

    Code:
    [FONT=Courier New][B]private string myCoolSetting = @"very cool"; // Default setting for MyCoolSetting[/B][/FONT]
    is where you set the default value, and the line

    Code:
    [FONT=Courier New][B][GridCategory("Parameters")]
    [/B][/FONT]


    is what makes MyCoolSetting show up on the parameters screen.
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Jessica. I notice that the lines are hidden as a default. Any way to make them visible by default?

      Also, if I want a price point listed here as a User Variable I would select "Double" correct? Then the Default is 1 and the Min is 1, but when editing the strategy from the control center/strategy tab the default number is 1. If I put in a price of say $50.00 for oil will it take a reading from the 'Min of 1" and perhaps undercut my price point or will it defer to only my price of $50.00? If it does not measure the 'Min of 1' then what is this for?

      Thanks once again!

      Best regards,

      Dolfan

      Comment


        #4
        Hello again Dolfan,

        . I notice that the lines are hidden as a default. Any way to make them visible by default
        The short answer is no. Expanding regions by default is an advanced topic. This publicly available stack overflow link would be a good place to start. http://stackoverflow.com/questions/3...al-studio-2010

        Also, if I want a price point listed here as a User Variable I would select "Double" correct?
        Yes

        Then the Default is 1 and the Min is 1...what is this for?
        This is to prevent invalid input. If you put in a price of $50.00, your strategy will treat this like $50.00 using generated code . If you put in a price of -$800.00, then because negative 800 is less than the minimum 1, the script will treat this as 1.

        Please let us know if there are any other ways we can help.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kaledus, Today, 01:29 PM
        5 responses
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PhillT, Today, 02:16 PM
        2 responses
        7 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Working...
        X