Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TypeConverter for strategies?

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

    TypeConverter for strategies?

    Hi,
    In the Pivots.cs example indicator there is a TypeConverter attribute set to allow hiding and showing of properties based on the selected value of an enum property.

    I want to do the same type of thing in my strategy. In other words, in the strategy analyzer I want to hide and show certain properties/settings based on values set in other properties/settings by the user.

    According to the notes in pivots.cs:
    // When creating a custom type converter for indicators it must inherit
    // from NinjaTrader.NinjaScript.IndicatorBaseConverter to work correctly with indicators

    There does not appear to be a NinjaTrader.NinjaScript.StrategyBaseConverter.

    Any tips or examples of how to get this type of functionality going in a strategy would be GREATLY appreciated and worth at least 2 Snickers bars.

    Thanks ... Ed

    #2

    Comment


      #3
      Hi,
      Thanks, but it doesn't address the issue:
      According to the notes in pivots.cs:
      // When creating a custom type converter for indicators it must inherit
      // from NinjaTrader.NinjaScript.IndicatorBaseConverter to work correctly with indicators

      There does not appear to be a NinjaTrader.NinjaScript.StrategyBaseConverter.
      Thanks ... Ed

      Comment


        #4
        Hello,

        I've just tested the code that Baruch posted via his link, and it does work as expected in NinjaTrader 8 after slight modifications for initialization and such. I've attached a NinjaTrader 8 version for your review. In the Strategies window, toggling the ShowA and ShowB properties will show or hide the InputA and InputB properties in the properties grid.

        Do you see the same thing on your end with this version?

        Edit:: I've just double-checked to make sure this will work with enums, as well, and it appears that it does. I added the following to the attached code:

        Code:
        public enum myEnum
                {
                    myEnumA = 0,
                    myEnumB = 1,
                };
        
                myEnum showAEnum;
        
                [Description("Show or hide A")]
                // [GridCategory("Parameters")]
                [RefreshProperties(RefreshProperties.All)]
                public myEnum MyEnum
                {
                    get { return showAEnum; }
                    set
                    {
                        showAEnum = value;
                            if(showAEnum == myEnum.myEnumA)
                                {
                                 showA = true;   
                                }
                       }
                }
        Originally posted by edstaffin View Post
        would be GREATLY appreciated and worth at least 2 Snickers bars.
        I think it's only fair that Baruch and I split the Snickers bars. Thank you.
        Attached Files
        Last edited by NinjaTrader_DaveI; 08-27-2015, 07:59 AM.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          One for each of you.
          Thanks a bunch!
          Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874436

          Comment


            #6
            Originally posted by edstaffin View Post
            One for each of you.
            Thanks a bunch!
            [ATTACH]33947[/ATTACH]
            Hey, hey, you said 2. That is only one you are showing. Do not stiff the helpers!

            Comment


              #7
              Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438
              Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438
              Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438Click image for larger version

Name:	Snickers.png
Views:	2
Size:	508.0 KB
ID:	874438
              There! I hope you are satisfied! Now go brush your teeth!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, 04-17-2024, 06:40 PM
              3 responses
              26 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by bmartz, 03-12-2024, 06:12 AM
              3 responses
              27 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by Aviram Y, Today, 05:29 AM
              2 responses
              8 views
              0 likes
              Last Post Aviram Y  
              Started by gentlebenthebear, Today, 01:30 AM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by cls71, Today, 04:45 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X