Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to get a series from a drawobject

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

    How to get a series from a drawobject

    I'm currently working on an indicator. As a part of that indicator, I have a Line and a TrendChannel being drawn. I want to use CrossAbove and CrossBelow to play a sound to alert the user of a specific change. However, I can't seem to figure out how to get a series from Line or TrendChannel in order to use CrossAbove and CrossBelow. Any help would be greatly appreciated.

    #2
    Hello learningnt,

    Drawing objects don't have series and don't have plots. They have anchors. These are the same anchors you see in the Draw Objects window in the Data section.

    The DrawObjects() page in the help guide has an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the info, Chelsea. However, if that's the case, how am I supposed to do something like this:

      Code:
      ...
      if (CrossAbove(High, <Line or TrendChannel>, 1)) { <do something>; }
      else if (CrossBelow(Low, <Line or TrendChannel>, 1)) { <do something else>; }
      ...
      I do see from the documentation that there are two choices for arguments with CrossAbove and CrossBelow:

      Code:
      CrossAbove(ISeries<double> series1, ISeries<double> series2, int lookBackPeriod)
      CrossAbove(ISeries<double> series1, double value, int lookBackPeriod)
      Code:
      CrossBelow(ISeries<double> series1, ISeries<double> series2, int lookBackPeriod)
      CrossBelow(ISeries<double> series1, double value, int lookBackPeriod)
      Since I can't get a series from the Draw Object, how do I get the value of that draw object at the same point in time of X bars ago?

      Comment


        #4
        Hello learningnt,

        CrossAbove()/CrossBelow() could check when the price is crossing a specific anchor but not a point along the line.

        The Alerts for manually drawn lines indicator for NinjaTrader 7 had custom logic to figure out when the price was crossing diagonal lines that are not horizontal.

        Updated 9-28-11: Used a simpler approach for horizontal lines and improved "no alert" message handling so that these messages should always be correctly removed. ========= This indicator will alert when the most recent bar crosses manually drawn lines. Works on lines, rays, horizontal lines, and extended lines. Apply the indicator to a chart and manually [&#8230;]



        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          So, when creating a Line or TrendChannel, we choose anchor points on either end, and it draws a line between those anchor points. This then makes it impossible to tell if we have crossed above or below that Line or TrendChannel as we're talking about some point between anchors and not the anchors themselves. Am I interpreting that correctly? Also, I'm using NT8, not NT7.

          Comment


            #6
            Hello learningnt,

            That would be correct.

            You have the anchors and you would need to determine the slope and intercept as demonstrated in the logic of the LineAlert indicator I have linked you.

            Its possible to do but requires custom logic.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            13 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by alifarahani, Today, 09:40 AM
            5 responses
            23 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X