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 llanqui, Today, 03:53 AM
            0 responses
            6 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            15 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            14 views
            0 likes
            Last Post strategist007  
            Working...
            X