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

        BertrandNinjaTrader Customer Service

        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 futtrader, 04-21-2024, 01:50 AM
            6 responses
            58 views
            0 likes
            Last Post futtrader  
            Started by sgordet, Today, 11:48 AM
            0 responses
            4 views
            0 likes
            Last Post sgordet
            by sgordet
             
            Started by Trader146, Today, 11:41 AM
            0 responses
            5 views
            0 likes
            Last Post Trader146  
            Started by jpapa, 04-23-2024, 07:22 AM
            2 responses
            19 views
            0 likes
            Last Post rene69851  
            Started by funk10101, Today, 11:35 AM
            0 responses
            3 views
            0 likes
            Last Post funk10101  
            Working...
            X