Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingObject Index

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

    #46
    Hello James,

    I had time to prepare an example for organizing tags in Lists so you can remove drawing objects for particular days.

    Accomplishing this requires decent knowledge of arrays and Lists, so I would recommend looking into publicly available C# resources on those topics if this example does not make sense.

    I'll also leave the thread open for discussion with s.kinra for their suggestion.
    Attached Files

    Comment


      #47
      Thank you. Jim.
      I'm a complete novice and have been learning with a lot of copy and paste.
      I will take a look and start reading up on some of the information you mentioned.
      I really appreciate everyone's time they have spent helping here.
      Thanks again
      James

      Comment


        #48
        Hello James,
        Yes, you need to have unique tag names for all objects / signals so having 6 diff tag names for 6 signals is good idea which can be dynamic by adding current bar (second method) or counter (first method). This will also allow you to understand which signal is drawn by tag. Counter usage I've already shown you with example script. Example tags names:- sig1_counter, sig2_counter etc.
        Hope it helps!

        Comment


          #49
          s.kinra, Good Morning (or night).
          Thank you for your reply. I believe this will help get it straightened out.
          I have a question on how the counter works with the unique signal tags.
          Does the counter (first method) count each unique signal separately or all of the signals? (example: If I set to only see the last 20 signals will it show me the last 20 signals of each unique signal or will it count the last 20 signals no matter if they are the same one or a different one?)
          I hope that made any sense.
          Thank you yet again for all your help.
          James

          Comment


            #50
            Hello James,
            Counter has nothing to do with tag names, its just a counter & will count from 0 by adding 1 to it on each bar update. Tag names need to be unique for drawing tools as they are used to remove objects so you can't have 2 objects with same tag, it has to be 1 & only 1, no exception. If you don't use counter or current bar along with tag names, it remains same every time so you get only 1 unique tag & you get only 1 object drawn on chart as a result.
            Now coming to your question, counter is defined only once & will do only counting from 0, its just a number & nothing else. You can use it along with your tag names to get multiple unique tag names (application part). If you use 1 tag name with counter you get 20 objects, if you use 2 tag names with counter you get 20 objects for each object means total 40 objects on chart (assuming you're drawing both objects on each bar / condition), refer my sample script & use a lower number (maybe 2 or 3) with first method so you can understand it in a better way. With 2 you will get 4 objects (2 high & 2 low).
            Hope it helps!

            Comment


              #51
              s.kinra,
              Thank you for the breakdown. I think I understand (petit). I will take a closer look at the sample script and test a few small numbers to understand more.
              Thank you again for your time. I'm indebted to this forum and hope to someday be a contributor.
              Thanks again.
              James

              Comment


                #52
                s.kinra,
                I think your breakdown helped. I have the counter in and it works (Yea). It counts each signal separately (buy, sell). Is it difficult to have them all be counted together?
                Thanks again for everything.
                James

                Comment


                  #53
                  Hello,
                  I have yet another question regarding the drawn objects on the chart.
                  Is there a way to set the Z-order of the objects so they do not plot in front of the price bars?
                  With all of everyone's help, I have got the charts running nicely and the objects plotting correctly.
                  The only thing is that they plot in front of the bars. I used the "Shift" scroll wheel but when the global objects update then the object then plots back in front of the bars.
                  So, I found a couple of things about the zorder but they were from quite a while back.
                  Let me know if is an option to place a bit of code in the indicator.
                  Thank you very much for everyone's help in learning the script.
                  James

                  Comment


                    #54
                    Hello James,
                    You can refer below link:-

                    Hope it helps!

                    Comment


                      #55
                      Hello s.kinra,
                      Thank you for the reference. This was what I was searching for.
                      Here is what I got but when reloading the chart the global lines are still in front of the price bars.
                      I put this code under the

                      protected override void OnStateChange()

                      if (State == State.Historical)
                      {
                      // Make sure our object plots behind the chart bars
                      SetZOrder(-1);
                      }

                      I think I'm missing something here.
                      Thank you in advance for any direction.
                      James

                      Edited: I found a post in which the person put the SetZOrder under OnBarUpdate and a support tech mentioned that was the place to put it with the if(State == State.Historical).
                      So, I tried this and the global objects are still in front of the bars.
                      I will continue to hack away.
                      James
                      Last edited by laoshr; 10-12-2021, 01:08 PM.

                      Comment


                        #56
                        Hello James,

                        SetZOrder sets the ZOrder for the indicator and objects drawn from the indicator in that chart.

                        If you are attempting to set global objects behind Chart Bars, it would be best to set the object's ZOrderType property to DrawingToolZOrder.AlwaysDrawnFirst.

                        Example:
                        Code:
                        private Dot myDot;
                        protected override void OnBarUpdate()
                        {
                            myDot = Draw.Dot(this, "tag"+CurrentBar, true, 0, Close[0], true, null);
                        
                            myDot.ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;
                        }

                        Comment


                          #57
                          Hello Jim,
                          Thank you for your reply. If the line below is my draw global object then I would add the template to the ZOrderType?
                          Draw.Line(this, tag, false, line.SRStartTime, line.SRPrice, endTime, line.SRPrice, true, "myMag");
                          myMag.ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;

                          Sorry, I'm a bit confused.
                          I don't have a myLine but if the criteria is true it has Draw.Line

                          Again thank you for the direction.
                          James

                          Edited: I did this but getting a "Line" is an ambiguous reference.
                          private Line myLine;
                          OnBarUpdate()
                          myLine = Draw.Line(this, tag, false, line.SRStartTime, line.SRPrice, endTime, line.SRPrice, true, "myMag");
                          myLine.ZOrderType = DrawingToolZOrder.AlwaysDrawnFirst;

                          Thank you again for any direction.
                          James
                          Last edited by laoshr; 10-12-2021, 01:58 PM.

                          Comment


                            #58
                            Hello James,

                            If you see an error for an "ambiguous reference" it would mean the compiler cannot tell which type you want to use. Using the fully qualified namespace for the type will resolve the ambiguity.

                            It would then be recommended to check documentation to see if you can find an example that shows proper usage, so you can reference the correct syntax.

                            Documentation for "Line" is linked below:

                            Comment


                              #59
                              Hello Jim,
                              Thank you for the reference. I think I got that to work. Yea!
                              Thank you for your help today.
                              You guys are awesome.
                              James

                              Comment


                                #60
                                Good Day,
                                I'm wondering if it is possible to have a UI setting for the DrawObject? I am using DrawObject instead of Plots because of the limited types available.
                                Is there a way to create a User Setting for the size of the ChartMarker?
                                Thanks again for all your support and knowledge. I could not have gotten this far without all of you.
                                James

                                Edited: Sorry, I posted too quickly. I found that the chart marker is tied to the bar width. It doesn't look like it can be sized with a UI setting. Let me know if I'm mistaken.
                                Thank you again.
                                James
                                Last edited by laoshr; 10-26-2021, 10:39 AM.

                                Comment

                                Latest Posts

                                Collapse

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