Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trigger order off user-defined line

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

    Trigger order off user-defined line

    In Ray's charting overview video, he mentioned that it is possible to trigger a order off a user defined line. Is there a NT method to do this, i.e., how do we know when price touches the line?
    thanks.

    #2
    astrolobe, this is possible via accessing the properties of the associated IDrawObjects (look for example in the ILine help guide article).

    Comment


      #3
      Bertrand, could you direct me to a ILine example in the help, as I do not see any example that shows me what the Y value is for a line, at a specific point in time.

      Comment


        #4
        There's none really unfortunately yet, as this is work in progress still - for the trendline end Y value, just access the ILine EndY property then...




        Comment


          #5
          Astro. Here's an example using the ILine object

          Code:
          ILine lObj;  //Make this global
          
          OnInitialize()
          {
              lObj = null;
          }
          
          
          //Create a line (somewhere in your code)
          lObj = DrawLine("sometag", true, 10, Close[0], 0, Close[0], Color.DimGray, DashStyle.Solid, 2);
          you can reference this object price value (or Y value) as such.
          Code:
          // Its good practice to ensure you don't reference a null object.
          if(lObj != null)
          {
              //EndY here is the price of the line on the chart.  
              if(somevalue > lObj.EndY)
             {
                ...
             }
          }
          You have a StartY and an EndY. These are two different endpoints that can be different values, unless you have a perfectly horizontal line. The help file describes these two ponits.

          You can also checkout IRay, IHorizontalLine, etc.

          Hope this helps.
          mrlogik
          NinjaTrader Ecosystem Vendor - Purelogik Trading

          Comment


            #6
            Thanks mrlogik, that will will help me to get going.

            Comment


              #7
              Betrand, in Ray's video at 20:47, he says that you can draw a line manually on a chart, then access it in a NT script (indicator) using its tag value. How would you do that?
              Is there a collection of Line objects that I need to loop through, searching for the tag, or is there a more direct method if I pass the tag into the indicator as a parameter?

              Comment


                #8
                Correct, you would need to loop through the tag ID collection, please see this thread here a snippet related - http://www.ninjatrader-support2.com/...ad.php?t=18540

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                605 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                351 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 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
                561 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X