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

Third party S/R levels

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

    Third party S/R levels

    I want to develop a strategy in NT7 that identifies lines from within NT. In other words, if an indicator plots horizontal lines, (fibs for example) I want to create a strategy that whenever horizontal lines are created by some indicator x, then execute the trade (even if the source behind those lines is unknown). There must be something within NT that can identify/detect when horizontal lines are plotted.
    Last edited by RJBen; 06-17-2017, 12:50 AM. Reason: Clarification

    #2
    Hello RJBen,

    Objects are only available outside of a class in C# if they are made public.

    You may be able to create a public array to hold these objects and get information about the objects on each bar update. (It may be necessary to call Update() in the get).

    I would recommend using a List object.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello RJBen,

      Objects are only available outside of a class in C# if they are made public.

      You may be able to create a public array to hold these objects and get information about the objects on each bar update. (It may be necessary to call Update() in the get).

      I would recommend using a List object.
      Do you care to dumb that down for me? lol

      Comment


        #4
        Hello RJBen,

        The code below is general C# is and not specific to NinjaScript (meaning this is not documented in the help guide and isn't guaranteed).

        The idea would be to create an array to hold the drawing objects.

        Code:
        private List<IDrawObject> myDrawingObjects;
        Code:
        myDrawingObjects = new List<IDrawObject>();
        Make this public
        Code:
        [XmlIgnore()]
        [Browsable(false)]
        public List<IDrawObject> MyDrawingObjects
        {
        	get
        	{
        		Update();
        		return myDrawingObjects;
        	}
        	set	{ }
        }
        And then as objects are drawn, these are added to the list.
        Code:
        myDrawingObjects.Add(DrawLine("myLineb", 30, High[0] + 2 * TickSize, 0, High[0] + 2 * TickSize, Color.Green));
        Then the strategy would access that public property
        Code:
        if (MyIndicator().MyDrawingObjects != null)
        {
        	foreach (IDrawObject draw in MyIndicator().MyDrawingObjects)
        	{
        		if (draw is ILine)
        		{
        			ILine line = draw as ILine;
        
        			Print(string.Format("{0}", line.StartY));
        		}
        	}
        }
        Create a new List, add elements to it, and loop over its elements with for and foreach.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea B. ROCKS!!!!

          Comment


            #6
            Next question, so long as these are levels on a chart, can we set Display in Data box to true and access the information from the Data box? Instead of trying to detect a level from indicator X can we instead extract the information from the Data box? It too has the price levels that I need.

            Comment


              #7
              Hello RJBen,

              Drawing objects will not appear in the Data Box.

              Plots will appear in the DataBox.

              Plots in an indicator can be returned in a strategy.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi Chelsea,
                I have a set of proprietary indicators that plot potential support and resistance levels based on market volatility. I put several different chart types on one chart (2 Range, 2 Time and 2 Volume). I made each chart a different color. Then I am looking for areas of confluence between those chart types. I've included a screenshot from yesterdays trading on the ES. I want to have an automation strategy created. But I need to be able to put the plots into the strategy to compare and find those areas of confluence as the source codes are closed. The Data box separates everything by chart types, colors and price values. So if I can extract that information, like into a spreadsheet, I can separate it by colors and compare price levels for areas of confluence. Can it be done?
                Attached Files
                Last edited by RJBen; 08-15-2017, 08:21 AM.

                Comment


                  #9
                  Hello RJBen,

                  Plots are intended to be called from other scripts when the data series are made public.

                  For an example, take a look at how the MACD indicator works. There are three plots in this, the Default plot, the Avg plot, and the Diff plot.

                  For example:
                  Print(MACD(12, 26, 9).Avg[0]);

                  This would print the most recent bar's value for the Avg plot in the MACD.

                  Are you creating public data series for your plots?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Sorry, I am not a programmer. What does, "creating public data series for your plots" mean?

                    Comment


                      #11
                      Hello RJBen,

                      This means using the public access modifier declaring the series within the scope of the class.

                      In the MACD this is in the region Properties on lines 105 through 124.

                      The example below shows exposing objects with the public access modifier.


                      The Values[plot index] series is what you wanting to expose.



                      If you are not a programmer you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChelseaB View Post
                        If you are not a programmer you can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                        It would be greatly appreciated to have a professional NinjaScript Consultant to pursue this with me. Thanks Chelsea. Please have someone at Business Development contact me.

                        Comment


                          #13
                          Hello RJBen,

                          This is Ryan L. from the NinjaTrader Ecosystem responding on behalf of my colleague Chelsea.

                          You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!

                          You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third party services for NinjaTrader all pricing and support information will need to be obtained through the consultant.

                          This 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 companies and services 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.

                          Please let me know if you have any questions, concerns or if I can provide any further assistance by responding to this thread at your convenience.
                          Ryan L.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by TheMarlin801, 10-13-2020, 01:40 AM
                          20 responses
                          3,914 views
                          0 likes
                          Last Post Bidder
                          by Bidder
                           
                          Started by timmbbo, 07-05-2023, 10:21 PM
                          3 responses
                          151 views
                          0 likes
                          Last Post grayfrog  
                          Started by Lumbeezl, 01-11-2022, 06:50 PM
                          30 responses
                          808 views
                          1 like
                          Last Post grayfrog  
                          Started by xiinteractive, 04-09-2024, 08:08 AM
                          3 responses
                          11 views
                          0 likes
                          Last Post NinjaTrader_Erick  
                          Started by Johnny Santiago, 10-11-2019, 09:21 AM
                          95 responses
                          6,194 views
                          0 likes
                          Last Post xiinteractive  
                          Working...
                          X