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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            68 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            38 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X