Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing trend lines in Strategies

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

    Accessing trend lines in Strategies

    I would like to combine my current strategy with a trend line crossover. I have a trend line on a chart of a larger fractal and want to see if price crosses that line from a strategy running on a smaller fractal.

    I see that I can attach a line to multiple charts, not sure if that can be used in anyway to let me access that trend line from inside a strategy.

    Any help/pointers would be appreciated.

    #2
    higher.high, unfortunately this is unsupported.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hello Austin,

      Thanks for your response.

      Is accessing a line from another chart not supported, or just accessing a line from current chart (on which a strategy runs) not supported as well?

      Comment


        #4
        higher.high, as long as it's on the primary series you can access those drawing objects as NT7 with the DrawObjects collection - http://www.ninjatrader.com/support/h...rawobjects.htm

        Comment


          #5
          Hello Bertrand,

          Let's say I give my trend line a "tag" and access it from my strategy. It is available as a ILine or IDrawObject object. Now is there a way to check in a Strategy's onBarUpdate() where the bar has acrossed the line?

          Thanks in advance.

          Comment


            #6
            higher.high,

            Perhaps there is some confusion here.

            All draw objects are IDrawObject objects. Then they are further categorized as things like ILine, IRay, etc.

            So the answer to your question is both. It is an ILine IDrawObject.

            You will need to custom program your own code to determine where the price crossed the line. From the ILine you can access its start and end anchor points. From there you can loop between each bar between the start and end point to find where price crossed its value. Obviously the line value on each bar would be different though so you would actually need to calculate out the slope of your line and determine the intercept on each of your bars to do this check.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            77 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            45 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            27 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            62 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X