Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Gaby V.NinjaTrader Customer Service

    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 ?
          Gaby V.NinjaTrader Customer Service

          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

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by joseph_kuruvilla12, Today, 01:01 AM
            0 responses
            3 views
            0 likes
            Last Post joseph_kuruvilla12  
            Started by joseph_kuruvilla12, Today, 12:40 AM
            0 responses
            1 view
            0 likes
            Last Post joseph_kuruvilla12  
            Started by joseph_kuruvilla12, Today, 12:13 AM
            0 responses
            4 views
            0 likes
            Last Post joseph_kuruvilla12  
            Started by stafe, 07-19-2024, 01:32 PM
            3 responses
            40 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by joseph_kuruvilla12, Yesterday, 10:29 PM
            0 responses
            5 views
            0 likes
            Last Post joseph_kuruvilla12  
            Working...
            X