Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Presetting Plots in Indicator

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

    Presetting Plots in Indicator

    I have a set of plots which I will update the values for each day before the market opens. Right now they are all lines and I would like to make one of them dots instead, to differentiate this particular plot from the others. I tried adding a PlotStyle statement to the indicator and it doesn't work. It seems there is a limit on how many modifications one can include in a plot statement. I'm including the code below that doesn't change the plot statement. Is there another way to do this (besides the manual way which I know works) but I'm trying to learn how to modify plots in indicators programmatically. I want the last plot (the fifth plot) to be dots instead of a line.
    Thanks

    protected override void Initialize()
    {
    Add(new Plot(new Pen(Color.DodgerBlue, 3), "BP_Low"));
    Add(new Plot(new Pen(Color.DodgerBlue, 3), "BP_High"));
    Add(new Plot(new Pen(Color.Magenta, 3), "SP_Low"));
    Add(new Plot(new Pen(Color.Magenta, 3), "SP_High"));
    Add(new Plot(new Pen( Color.Chartreuse, 3), "PitBull_MovAvg"));
    Plots[4].PlotStyle = PlotStyle.Dot;

    #2
    Did you reapply the indicator fresh after compiling the code modifications in?

    Comment


      #3
      Yes. I took the indicator completely off the chart, reapplied it and filled in the daily values fresh. I have four lines on the chart (the first four) properly colored and in the correct location. The fifth line (designated Plots[4] in the code) doesn't show up at all. If I remove the last definition line in the initialize section (Plots[4].PlotStyle = PlotStyle.Dot; ) meaning I comment it out, the fifth line shows up in the right location, in the right color, as a line.

      Comment


        #4
        Daven, sorry I missed in the first post you were using the Pen object for the Plots, then you would need to use DashStyle.Dot -

        Code:
         
        Plots[0].Pen.DashStyle = DashStyle.Dot;

        Comment


          #5
          That did the trick. Is there anyway I can add a pen size statement to the code to make the dots bigger? I tried changing them manually on the chart and they seem to be stuck at size 1?
          Thanks a bunch for your help.
          DaveN

          Comment


            #6
            You're welcome, you can add for example this to set the Pen width -

            Code:
             
            Plots[4].Pen.Width = 5;

            Comment


              #7
              Worked great. Thanks for your help Bertrand. Have a great weekend.
              DaveN

              Comment


                #8
                Thanks, have a good weekend, too!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                599 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                345 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                558 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                558 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X