Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add SecondaryInstrument as a data series

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

    Add SecondaryInstrument as a data series

    I have a chart with 2 data series.

    I would like to add the the second charted data series as a Bars Object within a script, e.g something like this:

    protected override void Initialize()
    {

    Add(Instrument.SecondInstrument.Name);


    Is there any way to find out the name for the second instrument on the chart, so that I can add it as a Bars Object?

    #2
    Hello AntiMatter,

    Thank you for your post.

    There is no method to pull a secondary instrument applied to the chart. We only have our input series being the main series and then any series we add through code.

    Comment


      #3
      Ahaa......


      Code:
              [Description("Second instrument.")]
              [GridCategory("Parameters")]
              [Gui.Design.DisplayName ("\t\t\t\t\t\t\t\t\t\t\t\tSecond Instrument")]
              public string Symbol2
              {
                  get 
                  {   // symbol2 defaults to secondary chart data series
                      if ((symbol2 == "") && (ChartControl != null) && (Instruments != null)) 
                          for(int i=0; i<ChartControl.BarsArray.Length; i++)
                              if (ChartControl.BarsArray[i].Instrument.FullName != Instruments[0].FullName)
                              {
                                  symbol2 = ChartControl.BarsArray[i].Instrument.FullName;
                                  break;
                              }
                      return symbol2; 
                  }
                  set { symbol2 = value.ToUpper(); }
              }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      239 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      155 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      164 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      247 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      199 views
      0 likes
      Last Post CarlTrading  
      Working...
      X