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

Accessing Objects drawn by an indicator in a script

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

    Accessing Objects drawn by an indicator in a script

    I've installed a 3rd party indicator to my NT7 strategy.

    It works as expected and draws arrows and diamonds on the chart to indicate opportunities. I can manually select these objects and see their properties.

    However, when I try to do the same thing in my script I get nothing. DrawObjects.Count = 0

    Any idea why manual works, but script doesn't?

    Thanks!
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Hello daqu40,

    Thank you for your post.

    So you are applying both scripts (third party and yours) to the same chart and looking for your script to pull the draw objects from the other (third party) script, correct?
    Or are you calling the third party indicator method in your script and trying to pull the objects?

    Either way, these objects from the third party script may be created through custom plotting and not through the DrawObjects. In which case NinjaScript will not see these from another script. For information on custom plotting please take a look at the script under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

    Can you send me a screenshot of the objects on the chart from the third party script?

    I look forward to your response.

    Comment


      #3
      Originally posted by daqu40 View Post
      I've installed a 3rd party indicator to my NT7 strategy.

      It works as expected and draws arrows and diamonds on the chart to indicate opportunities. I can manually select these objects and see their properties.

      However, when I try to do the same thing in my script I get nothing. DrawObjects.Count = 0

      Any idea why manual works, but script doesn't?

      Thanks!
      A class can only access the public properties, members or fields of another object. While it is possible to make DrawObjects public, I have never met any NT coder who actually does it.

      You are better off duplicating the conditions that draw the objects and keying off those. If you do not know those conditions, you could always contact the vendor, and request him to provide some access to those triggers.

      Comment


        #4
        Thanks for the quick reply. I'm pretty sure they are using Ninja IDrawObjects. I've attached a screen shot of what I can do manually.

        The selected Arrow Up Properties are in the dialog box.

        I've seen other charts with similar markings, but I'm not able to select and view properties.

        Thanks.
        Attached Files
        daqu40
        NinjaTrader Ecosystem Vendor - QTradez

        Comment


          #5
          Thanks koganam,

          I'm aware of public vs. private items in the chart. When I've encountered this in the past I'm not able to manually interact with these objects at all.

          In this case I can manually select the objects. (up/Down Arrow and Diamonds)

          I attached a sample to my reply to Patrick_H. See if that give you any ideas as to what's happening.

          I did also write to the indicator provider asking their assistance.

          I'm open to other ideas like trying to capture events that I can get the indicator to throw like alter sounds.
          daqu40
          NinjaTrader Ecosystem Vendor - QTradez

          Comment


            #6
            Originally posted by daqu40 View Post
            Thanks for the quick reply. I'm pretty sure they are using Ninja IDrawObjects. I've attached a screen shot of what I can do manually.

            The selected Arrow Up Properties are in the dialog box.

            I've seen other charts with similar markings, but I'm not able to select and view properties.

            Thanks.
            Yes, that shows that they are DrawObjects. Regardless, DrawObjects whether explicitly or implicitly declared are, by default, private, so unless explicitly declared public are not going to be available from another class script.

            Given what I see, I doubt that the vendor is going to give away the secret sauce. You can always try to get the ChartControl for the vendor indicator and see if you can access any of its objects, which would include any DrawObjects. Otherwise, your best choice is still to ask the vendor to provide a public means of tracking the signals.

            Comment


              #7
              Thanks again Osikani,

              I started work on the ChartControl last night so with your advice to try that next I'm feeling better I'll find a way to do this without having to complete reverse engineer the 3rd party indicator.
              daqu40
              NinjaTrader Ecosystem Vendor - QTradez

              Comment


                #8
                Making progress... I was able to programatically access the DrawOjects by taking the ChartControl.Indicatos[0].DrawObjects route.

                Now the curious part. When do a foreach loop on this it spits out several of the objects, but they are in no particular order and many of them have a time stamp that is is the future from the time of the bar where I call the enumerator. I'm sure this is due to multi-threading and wouldn't be as much of a problem in live data, but it's making my debugging a nightmare.

                I've seen some enumerable structures that allow copying and sorting and I'm just not seeing that for this one.
                daqu40
                NinjaTrader Ecosystem Vendor - QTradez

                Comment


                  #9
                  Originally posted by daqu40 View Post
                  Making progress... I was able to programatically access the DrawOjects by taking the ChartControl.Indicatos[0].DrawObjects route.

                  Now the curious part. When do a foreach loop on this it spits out several of the objects, but they are in no particular order and many of them have a time stamp that is is the future from the time of the bar where I call the enumerator. I'm sure this is due to multi-threading and wouldn't be as much of a problem in live data, but it's making my debugging a nightmare.

                  I've seen some enumerable structures that allow copying and sorting and I'm just not seeing that for this one.
                  What kind of error are you getting when you try to treat the collection as an enumeration? If it comes to it, you can always copy the collection into a List<string>, then use enumeration methods on the List.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  5 responses
                  22 views
                  0 likes
                  Last Post trilliantrader  
                  Started by Davidtowleii, Today, 12:15 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Davidtowleii  
                  Started by guillembm, Yesterday, 11:25 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post guillembm  
                  Started by junkone, 04-21-2024, 07:17 AM
                  9 responses
                  70 views
                  0 likes
                  Last Post jeronymite  
                  Started by mgco4you, Yesterday, 09:46 PM
                  1 response
                  14 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X