Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Interface with manually drawn levels

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

    Strategy Interface with manually drawn levels

    Pretty much all the information is in the title. I would REALLY like to not HAVE to calculate and program all my key levels. As this would be very time consuming. So I am hoping there is some way a strategy can interface with manually drawn objects. Is this possible? Can you link to this? I know that each drawn object has a unique ID, so it seems like it would be possible. It may not be entirely necessary, but would help cut down on fake alerts.

    #2
    Hello RISKYBUSINEZZ,

    Thank you for your post.

    Your strategy can interface with manually drawn objects on the chart. You can access them programmatically through the DrawObjects collection.

    The Help Guide page below has sample code demonstrating accessing drawing objects through the collection.



    IDrawingTool exposes information regarding a drawn chart object, such as if it is manually drawn (isUserDrawn).



    Please let us know if you need further assistance.

    Comment


      #3
      Lets GOO! Perfect! This will speed things up tremendously.

      Comment


        #4
        So I am looking over the information, but the problem I have is that it doesn't specify like how to get the ID of a manually drawn object. or logic to see if one exists. So I am trying to something like this:

        get horizontal_chart_objects //DONT KNOW where to do this with chart objects.

        for(int count = 0; count < chart_objects.Count; count++)
        {
        if(
        open[3]>close[0]
        && horizontal_chart_objects[count]< open[3]
        && horizontal_chart_objects[count]>close[0]
        && horizontal_chart_objects[count] == IsUserDrawn
        )

        {
        then do logic
        }​
        }

        The article you mentioned contained the following:
        if(IsUserDrawn)
        {
        //Then do thing
        }


        My problem is that this doesn't give me the ability to look for a horizontal level or do any sort of comparator or assignment operations. (<,>,==, =) So I don't really know how this can be used...

        Thanks!

        Comment


          #5
          Hello,

          What kind of drawing object are you trying to detect? Is it a horizontal line drawing object?

          The code below demonstrates looping through the drawing objects collection, finding Line draw objects, and will print out the tag and if the line is user drawn.
          Code:
          protected override void OnBarUpdate()
          {
          // Loops through the DrawObjects collection via a threadsafe list copy
          foreach (DrawingTool draw in DrawObjects.ToList())
          {
          if (draw is DrawingTools.Line)
          {
          // Indicates if this is a manually drawn or script generated line
          Print("Line Object: " + draw.Tag + " Manually Drawn: " + draw.IsUserDrawn);
          }
          }
          }
          ​
          What values of the drawing object are you trying to compare with the comparison operators ?

          Comment


            #6
            Yes, Okay. Now I see. That is correct, I am trying to detect Horizontal lines. That should do nicely! This also gives me a few other helpful terms to look up the NT8 library, which I can use elsewhere.

            Comment


              #7
              I want to follow up on this for anyone else needing this. I found the following code to work better when getting all the user drawn lines that the code referenced from the NT8 manual. While this pulls in more than just lines you can do more from this point.

              foreach (DrawingTool draw in DrawObjects.ToList())
              {
              if (draw.IsUserDrawn)
              {
              // Indicates if this is a manually drawn or script generated line
              Print("Line Object: " + draw.Tag + " Manually Drawn: " + draw.IsUserDrawn);
              }
              }​


              The results are as follows on the Output screen:


              ine Object: Rectangle 4 Manually Drawn: True
              Line Object: @Horizontal Line 756 Manually Drawn: True
              Line Object: @Horizontal Line 757 Manually Drawn: True
              Line Object: @Line 10 Manually Drawn: True
              Line Object: @Horizontal Line 759 Manually Drawn: True
              Line Object: @Horizontal Line 760 Manually Drawn: True
              Line Object: @Horizontal Line 761 Manually Drawn: True
              Line Object: @Horizontal Line 762 Manually Drawn: True
              Line Object: Line 16 Manually Drawn: True
              Line Object: Rectangle 4 Manually Drawn: True
              Line Object: @Horizontal Line 756 Manually Drawn: True
              Line Object: @Horizontal Line 757 Manually Drawn: True
              Line Object: @Line 10 Manually Drawn: True
              Line Object: @Horizontal Line 759 Manually Drawn: True
              Line Object: @Horizontal Line 760 Manually Drawn: True
              Line Object: @Horizontal Line 761 Manually Drawn: True
              Line Object: @Horizontal Line 762 Manually Drawn: True
              Line Object: Line 16 Manually Drawn: True​
              Last edited by RISKYBUSINEZZ; 01-10-2025, 05:17 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              113 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              60 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              40 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              43 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              81 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X