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

Make string Ninjascript Property Optimizable

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

    Make string Ninjascript Property Optimizable

    I have the following code below :

    Code:
    [NinjaScriptProperty]
            [TypeConverter(typeof(StrategyStringConverter))] // Converts the found ATM template file names to string values
            [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] // Create the combo box on the property grid
            [Display(ResourceType = typeof(Custom.Resource), Name = "Add Signal", GroupName = "Entries 1", Order = 0)]
            public string Signal1
            { get; set; }​
    This creates a list of strings selectable but I cannot optimize it. When I select the Optimize Backtest type, it doesn't let me try a range.

    #2
    Hello JakeOfSpades,

    Thank you for your inquiry.

    Are you using an enum to create a list of selectable strings in the Optimizer?

    Please see the sample script linked below, which demonstrates using TypeConverter and using an enum. These values are selectable in the Optimizer.

    https://ninjatrader.com/support/help...r_to_custo.htm

    If you have any other questions, please let me know.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello JakeOfSpades,

      Thank you for your inquiry.

      Are you using an enum to create a list of selectable strings in the Optimizer?

      Please see the sample script linked below, which demonstrates using TypeConverter and using an enum. These values are selectable in the Optimizer.

      https://ninjatrader.com/support/help...r_to_custo.htm

      If you have any other questions, please let me know.
      Can't use enums as some of the strings have spaces and special symbols. Any ways to optimize a list of strings?

      Comment


        #4
        Hello,

        Unfortunately no, there is no way to optimize a list of strings.

        A custom type converter is needed, which will not function in the strategy analyzer.

        A TypeConverter used on an input in a NinjaScript Strategy will be disabled when the strategy is selected in the Strategy Analyzer.

        While the strategy can still be backtested or optimized, the TypeConverter behavior, such as hiding or disabling inputs will not have effect on any public variables using the [NinjaScriptProperty] attribute.

        This is due a limitation with the property grid and how the analyzer displays the [NinjaScriptProperty] marked properties of the strategy.

        A suggested work around, is to add an extra bool property for the purpose of controlling if other properties are used within the logic of the script.

        This property would not be optimized and would have the single purpose of controlling the use of the properties.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Gaby View Post
          Hello,

          Unfortunately no, there is no way to optimize a list of strings.

          A custom type converter is needed, which will not function in the strategy analyzer.

          A TypeConverter used on an input in a NinjaScript Strategy will be disabled when the strategy is selected in the Strategy Analyzer.

          While the strategy can still be backtested or optimized, the TypeConverter behavior, such as hiding or disabling inputs will not have effect on any public variables using the [NinjaScriptProperty] attribute.

          This is due a limitation with the property grid and how the analyzer displays the [NinjaScriptProperty] marked properties of the strategy.

          A suggested work around, is to add an extra bool property for the purpose of controlling if other properties are used within the logic of the script.

          This property would not be optimized and would have the single purpose of controlling the use of the properties.
          I figured it out, I had to use enums and the Display Name Attribute for my custom text. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jonafare, 12-06-2012, 03:48 PM
          5 responses
          3,985 views
          0 likes
          Last Post rene69851  
          Started by Fitspressorest, Today, 01:38 PM
          0 responses
          2 views
          0 likes
          Last Post Fitspressorest  
          Started by Jonker, Today, 01:19 PM
          0 responses
          2 views
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          7 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,792 views
          0 likes
          Last Post aligator  
          Working...
          X