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 agclub, 04-21-2024, 08:57 PM
            5 responses
            32 views
            0 likes
            Last Post agclub
            by agclub
             
            Started by ESHunter, Today, 08:06 PM
            2 responses
            18 views
            0 likes
            Last Post ESHunter  
            Started by ETFVoyageur, 05-07-2024, 07:05 PM
            19 responses
            150 views
            0 likes
            Last Post ETFVoyageur  
            Started by ETFVoyageur, Yesterday, 10:13 PM
            3 responses
            26 views
            0 likes
            Last Post ETFVoyageur  
            Started by ETFVoyageur, Yesterday, 12:52 AM
            3 responses
            33 views
            0 likes
            Last Post ETFVoyageur  
            Working...
            X