• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
    https://ninjatrader.com/support/help...rawobjects.htm
    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.

        https://ninjatraderecosystem.com/use...y-drawn-lines/


        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 deblanka, Today, 08:56 AM
            0 responses
            3 views
            0 likes
            Last Post deblanka  
            Started by Boonfly8, Yesterday, 12:30 PM
            7 responses
            18 views
            0 likes
            Last Post sledge
            by sledge
             
            Started by Sohal, Today, 05:02 AM
            2 responses
            10 views
            0 likes
            Last Post techmint  
            Started by danitralla, Today, 03:33 AM
            0 responses
            5 views
            0 likes
            Last Post danitralla  
            Started by yeshujbp, Today, 12:37 AM
            0 responses
            16 views
            0 likes
            Last Post yeshujbp  
            Working...
            X