Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hide Standard Strategy Parameters

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

    Hide Standard Strategy Parameters

    Hello,

    I would like to hide several standard parameters from the Strategy Properties page.

    For example
    Data Series
    Type
    Value

    Set up
    Start Behavior
    Maximum Bars lookup


    In my strategies such parameters are fix and I don't want to confuse the user, so I would like to hide them.
    In NT7 you could do
    [Gui.Design.DisplayName("Default quantity")]
    [Category("Order Properties")]
    [Browsable(false)]
    public int DefaultQuantity

    but NT8 is different


    Andreas
    Attached Files

    #2
    Hello,

    Thank you for the question.

    In a situation when you want to hide an inherited property from a base class, you need to use the new keyword and the original property name and spelling:

    Code:
    [Browsable(false)]
    public new Calculate Calculate {get;set;}
    		
    [Browsable(false)]
    public new int DefaultQuantity {get;set;}
    		
    [Browsable(false)]
    public new StartBehavior StartBehavior {get;set;}
    As this is hiding the base property, to set the actual base property please ensure to call base instead of the new property name:

    Code:
    base.Calculate = Calculate.OnEachTick;
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you,

      it is generally working , but not for the Instrument Property.

      I want something like this to work, so the description of Instrument should be changed to "Leg 1 Instrument", but it is not.

      Then, the Instrument name is given without the exchange added? How come? Using a second Instrument Instrument2 Property there I get the Instrument name with exchange appended.

      How to change the description for Instrument ,?


      Andreas

      NOT WORKING



      [Display(ResourceType = typeof(Custom.Resource), Name = "Leg 1 Instrument", Description = "Leg 1 o Spread", GroupName = "Data Series", Order = 0)]
      public new NinjaTrader.Cbi.Instrument Instrument {
      get {return base.Instrument;}
      set {base.Instrument=value;}

      }



      P.S.

      If I want to hide the Slippage parameter then the strategy does not show up any more in the Strategies Dialog. How to hide it?

      // [Browsable(false)]
      // public new int Slippage{get;set;}
      Last edited by zweistein; 09-28-2017, 12:54 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        In this case, a more robust solution would be to use the property descriptor collection for the hiding of properties. Instead of creating a new property, you could use the attached example in regard to hiding items.

        For the instrument property, I have been unable to see a way to modify this properties name or description. I tried a new property as previously discussed, and a few variations using the property descriptors but I was unable to see a solution for changing the existing attributes. I can see other potential problems surrounding this as there is error checking in the user interface, a problem with hiding the existing property is that the UI reports no instrument is selected.

        If you would like to continue experimenting with the instrument property, I may suggest reviewing the general C# concept of property descriptors and the attached example. I am not certain if changing the display name and description on this existing property is possible. Potentially you may be able to locate a way to generate a new property descriptor based on the existing one. I am afraid this would be outside of what I could assist with further though so this would be an item that you could experiment with.

        We have some documentation on this concept at the following link, but as this is a general C# concept a search will provide more results.

        https://ninjatrader.com/support/help...=typeconverter


        I look forward to being of further assistance.
        Attached Files
        JesseNinjaTrader Customer Service

        Comment


          #5
          thanks for looking into, I used typeconverters in NT7, they are tedious and cumbersome, I think it is overkill here.

          By the way, what is the name of the TypeConverter NT8 uses for the Strategy Instrument type?

          Please could you give me just the names of all Property decorator Attributes that you use in NT8, for example [Browsable] , etc...

          that makes it easier to find a solution.
          Also, good old snoop (injection into code) does not work anymore since nt8.


          Thank you

          Andreas

          Comment


            #6
            Hello,

            Thank you for the reply.

            Unfortunately, I couldn't say what the specific syntax used in the strategy menu is that creates a different picker depending on the menu used as I do not have that available for review. Because this is a core feature of how the platform works, there are no samples or information for hiding or otherwise modifying these properties from NinjaScript as they are necessary for all strategies to run. As noted previously this would not be an item I could further assist with but You are free to experiment on your own to see if you can locate a solution that works for the purpose.

            A strategy by nature has either a drop-down menu which lists the currently available series (chart) or an Instrument picker control when used from the control center or backtests. As this is changed depending on the tool being used I am unsure of a way you could also recreate this change for a custom instrument property. I previously provided a note that editing the existing property may also be possible using the property descriptor collection but this would be a subject which I could not further assist with and would be something you could explore if need be.

            Regarding the attributes, there are only a few that are relevant to NInjaScript. We do have a short guide on the common attributes here:
            https://ninjatrader.com/support/help...tsub=attribute

            Please let me know if I may be of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Leeroy_Jenkins, 01-23-2021, 03:00 AM
            1 response
            23 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by vantojo, Today, 09:32 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by FelipeRXP, Today, 08:40 AM
            2 responses
            14 views
            0 likes
            Last Post FelipeRXP  
            Started by petedian, Today, 08:44 AM
            0 responses
            18 views
            0 likes
            Last Post petedian  
            Started by J0shTrader, Yesterday, 12:29 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X