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

How to Gui.CategoryOrder Plots?

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

    How to Gui.CategoryOrder Plots?

    Hi,

    I would like to group some of my Plots into a different Category in the settings screen of the indicator.

    Now I can add parameters to the Plots category by using:
    Code:
    # NOTE just reformatted the code a bit for clarity
    [XmlIgnore]
    [Display(ResourceType = typeof(Custom.Resource), 
                  Name               = "Placid lake filler", 
                  Description       = "Sets the color of a placid lake condition", 
                  GroupName     = "Plots", Order = 1)]
    public System.Windows.Media.Brush PlacidLakeBrush
    	{ get; set; }
    That is working fine, but now the other way around, take one plot and put it into a different category?,

    How would I move one Plot from the Plots category into a new category? How do I do that? I tried the following but it is not working

    Code:
    # NOTE just reformatted the code a bit for clarity
    [Browsable(false)]
    [XmlIgnore]
    [Display(ResourceType          = typeof(Custom.Resource), 
                               Name           = "Placid lake condition", 
                               Description   = "Placid lake condition", 
                               GroupName = "Market Analyser Conditions", 
                               Order            = 1)]
    public Series<double> PlacidLake
    {
    	get { return Values[2]; }
    }
    Many thanks in advance for the help.

    JWR

    #2
    Hello Wessel,
    Thanks for your post.

    To make your "Market Analyzer Conditions" category viewable in the settings screen of the indicator you will need to either remove the top line "[Browsable(false)]" or change the boolean to "true".

    That being said, even though the property will be viewable with the change mentioned above you will not be able to modify that series. What kind of setting are you trying to add here?

    I look forward to your reply.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      I'm trying to do this as well and am having difficulties with it because like you said, when Browsable is true I am not able to modify the plot.

      I would like to edit the color, dashstyle, plotstyle, width, and opacity of this plot under a different group name. It's basically moving the plot from GroupName "Plots" to a new GroupName.

      Any guidance is much appreciated.

      Thank you.

      Comment


        #4
        Hi KINGKODA, thanks for your note.

        The Plots sections is handled by NinjaScript when loaded on the menu. Series objects just hold values, so there are not any properties to change about that. As an example see the SMA indicator. When you add a plot to your script with AddPlot this Plots section will already have properties you can edit. To have a group of properties in their own section you can make a collapsable class property type like this:

        Code:
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public class LevelIIColorCollection : ICloneable
        {
            [Browsable(false), XmlIgnore]
            public System.Windows.Media.Brush[] MyBrushes;
        
            public LevelIIColorCollection()
            {
                MyBrushes = new System.Windows.Media.Brush[2];
            }
        
            public object Clone()
            {
                LevelIIColorCollection newCollection = new LevelIIColorCollection()
                {
                    Level01Color    = Level01Color,
                    Level02Color    = Level02Color
                };
        
                return newCollection;
            }
        
            public override string ToString()
            {
                return string.Empty;
            }
        
            [XmlIgnore]
            [Display(Name = "Level 1 Color", Order = 6, GroupName = "Parameters")]
            public Brush Level01Color
            {
                get { return MyBrushes[0]; }
                set { MyBrushes[0] = value; }
            }
        
            [Browsable(false)]
            public string Level01ColorSerializable
            {
                get { return Serialize.BrushToString(Level01Color); }
                set { Level01Color = Serialize.StringToBrush(value); }
            }
        
            [XmlIgnore]
            [Display(Name = "Level 2 Color", Order = 7, GroupName = "Parameters")]
            public Brush Level02Color
            {
                get { return MyBrushes[1]; }
                set { MyBrushes[1] = value; }
            }
        
            [Browsable(false)]
            public string Level02ColorSerializable
            {
                get { return Serialize.BrushToString(Level02Color); }
                set { Level02Color = Serialize.StringToBrush(value); }
            }
        }
        
        ...
        
        [Display(Name = "Level II Colors", Description = "Level II Colors", Order = 6, GroupName = "Parameters")]
        public LevelIIColorCollection LevelIIColors
        { get; set; }
        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mizzouman1, Today, 07:35 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Radano, 06-10-2021, 01:40 AM
        20 responses
        616 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by i019945nj, 12-14-2023, 06:41 AM
        6 responses
        68 views
        0 likes
        Last Post i019945nj  
        Started by aa731, Today, 02:54 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by BarzTrading, Today, 07:25 AM
        0 responses
        3 views
        0 likes
        Last Post BarzTrading  
        Working...
        X