Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add second instrument when loading indicator as a paramater

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

    Add second instrument when loading indicator as a paramater

    Hi,

    Is it possible to add an instrument as a parameter?

    For example in the code below the instrument is hard-coded I want to know if I can make it so a user can enter 6A 09-12 as a parameter when I load the indicator?

    I have searched on the forums for sometime and whilst I could find some that covered the topic I'm still not quite sure if it can be done or not?

    Code:
     
    #region Variables
            
            private Font myFont             = new Font("Arial", 8, FontStyle.Regular);
            
            #endregion
    
            /// <summary>
            /// This method is used to configure the indicator and is called once before any bar data is loaded.
            /// </summary>
            protected override void Initialize()
            {
                
                Add("6A 09-12", PeriodType.Minute, 1);
                
                Add(new Plot(new Pen(Color.White, 5), PlotStyle.TriangleUp, "Long"));
                
                CalculateOnBarClose                = false;
                Overlay                            = true;
            }
    Regards,
    suprsnipes

    #2
    Yes, this is possible. Take a look at the following indicator which uses an Instrument name as a string for a user defined input parameter:


    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    161 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    309 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    245 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    349 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X