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

Editing complex indicator properties

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

    Editing complex indicator properties

    I'd like to expose an object as an indicator property that the user can edit.
    I've done some experiments using the [Display] and [TypeConverter] attributes but found nothing that works - how can I expose object properties in the indicator property editor please?
    (The [XmlIgnore] attribute will be used on the property, I'll take care of serialization another way)

    #2
    Ok I managed to get it working with this attribute:
    [TypeConverter(typeof(ExpandableObjectConverter))]



    The next challenge is to get the header summary view to look something like the one for a plot does, but with two colors:



    How can I approach the problem of achieving this?

    Comment


      #3
      Hello bboyle1234,


      I have submitted a feature request to the product management team for the following feature :


      This customer would like the ability to nest properties in a tree in the properties window through NinjaScript


      I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.


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

      Comment


        #4
        Hello bboyle1234​,

        This feature is being reviewed by the product management team and has been assigned the following unique tracking ID


        SFT-1647


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

        Comment


          #5
          Hey bboyle1234,

          I wanted to update this thread as I have found a way to do this.

          There are two things you'll need to create right off the bat.

          First is a ResourceDictionary and add in a DataTemplate Tag via this -
          P.S. You can put whatever you want in the DataTemplate, this was just for my needs on my properties
          Code:
          	<DataTemplate x:Key="{DataTemplateKey {x:Type models:PriorityEventModel}}" DataType="{x:Type models:PriorityEventModel}">
          		<Grid>
          			<Grid.ColumnDefinitions>
          				<ColumnDefinition Width="Auto"/>
          				<ColumnDefinition Width="*"/>
          			</Grid.ColumnDefinitions>
          			<Rectangle I****TestVisible="False"
                                   Margin="6, 0"
                                   Width="30"
                                   Height="10"
                                   VerticalAlignment="Center"
                                   StrokeThickness="1"
                                   Stroke="{DynamicResource BorderThinBrush}"
                                   Fill="{Binding Stroke.Brush}"/>
          			<TextBlock Grid.Column="1"
                                   VerticalAlignment="Center"
                                   TextTrimming="CharacterEllipsis"
                                   Text="{Binding StringFormat}"/>
          		</Grid>
          	</DataTemplate>
          Note that PriorityEventModel is the Type of the property in your script and the Bindings are for that Type's properties. That Type is how we get the Object and DataTemplate Key to match up at runtime.

          The second piece is where you need to load this resource into the Application's resources, NinjaTrader in this case.
          Code:
          Application.Current.Resources.MergedResources(new ResourceDictionary { Source = new Uri("/YourAssemblyName;component/**FilePath*") } );
          
          **The rest of this is the folder path you have the resource dictionary in the dll solution, e.g. If I place the file in Folder, named Themes, under the main project my line would look like this => component/Themes/MyFile.xaml*
          Note that this is how you get a COMPILED resource file. If you don't use a compiled resource then you want to reference the file path, where the resource file is located, on the machine in question.

          I would not recommend the use of an indicator as you can have multiple instances running over and over and would cause a memory leak with the application. I used an AddOn to load in my resources as it will do it once at application startup, for me.

          Comment


            #6
            Thank you very much for this code sample, Calonious.

            While your solution is elegant and allows the developer to set any label to the right of the property, I did want to add some feedback I received from one of my colleagues related to the submitted feature request. Nested classes with this tag,

            Code:
                    [TypeConverter(typeof(ExpandableObjectConverter))]
            can in turn have their tags read into the output XML. If you override the nested class' ToString method, this will set the label text to the right of the property in the property window.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Correct Jessica! That is the best simplistic solution if you don't need anything displayed on that line.

              Comment


                #8
                I'm jumping in here old conversation to ask the creator of this Head And Shoulders Drawing Tool a question. The 1st pic is the actual picture of indicator then I download it and the 2nd pic is what I see on my chart? With this indicator is there any option to fade the color of the blue box or remove it? I guess it doesn't really do what the picture actually shows?

                Do you have any improvements of this indicator or any others that identifies various patterns? Thanks
                Attached Files

                Comment


                  #9
                  Hello trdninstyle,

                  Thank you for your reply.

                  You're comparing apples to oranges here - these are two separate items, one is a drawing tool, which you would use to manually draw on a chart from the Drawing Tools menu, the the other is a pair of indicators based on an article from a 2013 issue of Technical Analysis of Stocks and Commodities magazine. For further information on this script, please see the the May 2013 Stocks and Commodities article titled Detecting Head & Shoulders Algorithmically by Giorgos E. Siligardos, PhD. I am not aware of any updates to this indicator, though as it is open source the code is available to you and can be modified however you see fit - you could modify it to remove the blue boxes or remove the background color for them.

                  The drawing tool is completely separate from these indicators and the one with the blue box does not use the Head and Shoulders drawing tool created by Calonious.

                  Please let us know if we may be of further assistance to you.
                  Kate W.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by andrewtrades, Today, 04:57 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by josh18955, 03-25-2023, 11:16 AM
                  6 responses
                  436 views
                  0 likes
                  Last Post Delerium  
                  Started by FAQtrader, Today, 03:35 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post FAQtrader  
                  Started by rocketman7, Today, 09:41 AM
                  5 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X