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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    36 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X