Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rays, Lines, Fibos as default

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

    Rays, Lines, Fibos as default

    i change the plattaform of ninja7 to ninja 8, and i see i can not set defaults for lines, rays, fibos etc, how can i set default for my indicators?.

    #2
    Hello Fingerman,
    Thanks for your post.

    Do you want to set the default color for those drawing objects inside your indicators code?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      yes, colors, forms, etc

      Comment


        #4
        Fingerman,
        To make a script run with a default setting you would set that brush/property in OnStateChange() inside State.SetDefaults.

        OnStateChange() can be used to filter out different stages of the entire life cycle of a script (SetDefaults, Configure, Historical, Realtime, Terminated, etc.) OnStateChange() is fully covered in the Help Guide here:


        The following snippet demonstrates how you would properly set a brush default in your script, along with the public property for the brush that allows the brush to be changed from the indicators settings.

        Code:
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                MyBrush                    = Brushes.Orange;
            }
        }
        
        [NinjaScriptProperty]
        [XmlIgnore]
        [Display(Name="MyBrush", Order=1, GroupName="Parameters")]
        public Brush MyBrush
        { get; set; }
        
        [Browsable(false)]
        public string MyBrushSerializable
        {
            get { return Serialize.BrushToString(MyBrush); }
            set { MyBrush = Serialize.StringToBrush(value); }
        }

        I suggest using the NinjaScript wizard to generate your inputs or plots so that you can simply copy/paste the public property into your code.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          omfg, if in ninjatrader7, you can set default witth 1 click, how in ninjatrader 8 need to do script??

          Comment


            #6
            Hello Fingerman,

            Thank you for your response.

            My colleague replied for a NinjaScript indicator. To set the defaults of Drawing Objects you need to double click on the object after drawing it --> set the desired options --> and then select 'template' at the bottom right hand corner of the Drawing Objects window --> select 'save' --> name the template 'Default' --> Save --> OK.

            For information on Drawing Objects please visit the following link: https://ninjatrader.com/support/help..._tools__ob.htm

            Please let me know if you have any questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            620 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            359 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            562 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            566 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X