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

  • RISKYBUSINEZZ
    replied
    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.

    Leave a comment:


  • NinjaTrader_Gaby
    replied
    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 ?

    Leave a comment:


  • RISKYBUSINEZZ
    replied
    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!

    Leave a comment:


  • RISKYBUSINEZZ
    replied
    Lets GOO! Perfect! This will speed things up tremendously.

    Leave a comment:


  • NinjaTrader_Gaby
    replied
    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.

    Leave a comment:


  • 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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by JackyP, 07-25-2023, 08:39 AM
3 responses
312 views
0 likes
Last Post Lancer
by Lancer
 
Started by TiffanyMiller, Yesterday, 10:19 PM
0 responses
2 views
0 likes
Last Post TiffanyMiller  
Started by algospoke, 05-13-2024, 06:53 PM
12 responses
133 views
0 likes
Last Post algospoke  
Started by psangram, Yesterday, 06:35 PM
0 responses
4 views
0 likes
Last Post psangram  
Started by Alaina19, 07-14-2024, 04:38 PM
2 responses
16 views
0 likes
Last Post Alaina19  
Working...
X