Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is Plots[x].Set(x + Close) possible?

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

    Is Plots[x].Set(x + Close) possible?

    I know what is in the title is not possible. I know that Plots are a collection holding all of the Plot objects that define the visualization characteristics of the indicator. The nice thing about Plots is that they can be indexed. I would like to be able to index through all my plots when I do a Plot.Set(). What si the best way to do this? Here is what I have:

    protected override void Initialize()
    {
    plot_history = new DataSeries[2];

    for( i=0; i<25; i++ )
    {
    Add( new Plot( short_up_color, PlotStyle.Line, "Plot" + i.ToString() ) );
    plot_history[i] = new DataSeries( this );
    }
    }

    protected override void OnBarUpdate()
    {
    This is not possible, but I would like to do something like this:
    for( i=0; i<25; i++) Plots[i].Set( special( i, x++ ) );

    I currently have to do this:
    Plot0.Set( plot_history[0] );
    Plot1.Set( plot_history[1] );
    Plot2.Set( plot_history[2] );
    * * *
    Plot2.Set( plot_history[24] );
    }

    #2
    Hello,

    Thank you for the question.

    What you are trying to do is certainly possible you would just need the correct syntax.

    Rather than calling the plot directly by its name, you would instead want to use the index system you already have.

    The Add statements are fine, to do the same in OnBarUpdate you would want to use Values instead of the PlotName.

    Code:
    protected override void Initialize()
    {
            for(int i = 0; i < 25; i++)
    	{
    		Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot" + i));	
            }
    }
    
    protected override void OnBarUpdate()
    {
    	for(int i = 0; i < 25; i++)
    	{
    		Values[i].Set(Close[0] + i);
    	}
    }
    I look forward to being of further assistance.

    Comment


      #3
      Thank you. Just what I was looking for.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      628 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
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X