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

Can this be done?

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

    Can this be done?

    Hello,

    I have basic programming skills, can build simple indicators and modify more complex ones. One I want to do is create an indicator which would draw zones. The start of the zone would be based on simple code acting as a signal (for sake of talk lets say it's an Inside Bar). Once the signal is triggered, the zone would be plotted (preferably as a filled in area but lines are okay too) indefinitely into the future.

    Once I got that much figured out, ultimately I'd like to code the thing so that the zones endpoints are based on when price fully retraces through the zone.

    Anyone willing to provide a general outline of how to do this? Maybe even have a very basic sample, even using just a single zone. I'm aware that I'll have to create a mechanism to create unique tags for each new zone.

    Thanks for any input.

    #2
    coolmoss,

    I am happy to assist you.

    Here is a link to a DynamicSRLines indicator in our indicators downloads you may be able to adapt to your needs : http://www.ninjatrader.com/support/f...d=4&linkid=483

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks much, I'll take a look. I'm sure anything is going to help get me started

      Comment


        #4
        coolmoss,

        No problem.

        Please don't hesitate to contact us should you require additional assistance.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          NS assemblies

          Originally posted by NinjaTrader_AdamP View Post
          coolmoss,

          No problem.

          Please don't hesitate to contact us should you require additional assistance.
          Dear Adam,

          The link to the s/r zones you provided really isn't close to what I was trying to do, however I found some NS code that looks like it would provide a starting point for me to expand my skills.

          However, the code seems to be part of what is called a NS Assembly. The NS will import and compile, but when the NS editor is opened, the assembly is not available for editing. I can open the .cs files with Notepad and I see references to Class creation and other more advanced programming.

          Do you have any basic, foundational references or tutorials on how assemblies work? I've always wondered how some guys are doing really complex stuff outside the bounds of the basic NS wizard. That is, how they create entire external files (not unlike what FINALG did with market profile).

          I'm not asking for a ton of actual programming help. I'd just like to understand the model for these assemblies and how they are created, what language are assemblies written in, perhaps even a VERY simple example assembly. I learn almost everything through reverse engineering simple stuff

          Comment


            #6
            coolmoss,

            Thanks for your note.

            Essentially I figured you wanted to highlight regions. This indicator does so.

            Please let me know if I may assist further.
            Attached Files
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hi Adam.

              Thank you.

              This still isn't what I'm looking to do. Picture this: at some bar (determined by code) the left edge of a rectangle is started (with the high of the rectangle at the high of the bar and low at low of bar). That rectangle is continued to be drawn, each bar that goes by the rectangle is updated to be at far right edge of chart. Rectangle continues to update until price retraces through the entire range of the bar that created the left edge of rectangle.

              I'd dearly appreciate answers or some direction to resources to questions in my last post. I've looked at the NS reference guide and the closest thing to what I'm looking for is under "Distribution". I can't locate any documentation whatsoever or an example I could study which demonstrates how to go about creating "assemblies".

              Comment


                #8
                coolmoss,

                You don't need an assembly to do this. When you download indicators with .dll's its usually because the author of the indicator is attempting to protect their code from being taken and used in other things, or copied by rivals. Essentially, you can use the DrawRectangle method outlined in that indicator to do what you ask, along with HighestBar and LowestBar essentially, if I am understanding your method correctly.

                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  Okay, thanks. Perhaps I'm making this harder than it needs to be. I really appreciate going back and forth with me on this. When I get something put together, I may post here to get feedback on challenges. I understand at some point you won't be able to help, but I figure something may be simple enough for you to comment on.

                  Comment


                    #10
                    coolmoss,

                    We are always happy to point you in the right direction and provide educational resources. The only thing we don't do is deep debugging and custom coding for individuals as our obligation and goal is to support everyone equally and this sort of endeavor is very time consuming.

                    Please let me know if I may assist further.
                    Adam P.NinjaTrader Customer Service

                    Comment


                      #11
                      Have you tried using plots? Set the plot to a constant value when you want it to plot the line, and then use the Reset() method when you want it to stop plotting.
                      For example Plot0.Reset();

                      VT

                      Comment


                        #12
                        From whatever I have read in the thread, I think I have already done something similar to what you are trying to do. I am posting a sample chart. If some condition is true (in this case convergence of moving averages), the code will start highlighting the area from the high of the starting bar to low of the same bar as long as that condition is true within the defined look back period. The chart that I have attached, I am using 20 bars look back period.
                        In this case the rectangle stays on the chart, until there is a new instance of the convergence, and you can easily remove the rectangle if the condition is not true.
                        I have used the ideas from the Dynamic Support Resistance indicator.

                        If you want to do something like this ... I can help.
                        Attached Files

                        Comment


                          #13
                          getting rectangles to extend

                          Here is total code in indicator:

                          Code:
                          protected override void OnBarUpdate()
                                  {
                                      // Use this method for calculating your indicator values. Assign a value to each
                                      // plot below by replacing 'Close[0]' with your own formula.
                          			foreach (IDrawObject draw in DrawObjects)
                          			{
                          				if (draw.Tag.Contains("myRec"))
                          				{
                          					IRectangle Extend = (IRectangle) draw;
                          					Extend.EndBarsAgo = BarsInProgress;
                          				}
                          			}
                          			if (Close[0] < SMA(20)[0])
                          			{
                          				DrawRectangle("myRec" +CurrentBar,10,Open[10],0,Close[10],Color.Blue);
                          			}
                                  }
                          The 'foreach' block I adopted from another post in the forum. If I remove the 'foreach' bock, the indicator will plot a whole bunch of rectangles just as I expect it to.

                          I can't find anything in the manual regarding the various methods inside the 'foreach'. Is this something you can help with Adam?

                          Comment


                            #14
                            coolmoss,

                            I can definitely look into it further for you.

                            One issue I see is that you are doing the follow : Extend.EndBarsAgo = BarsInProgress;

                            BarsInProgress is used for multi-instrument strategies to pick out which data series is calling the OnBarUpdate() method. What are you trying to assign to Extend.EndBarsAgo?
                            Adam P.NinjaTrader Customer Service

                            Comment


                              #15
                              making progress

                              Originally posted by NinjaTrader_AdamP View Post
                              coolmoss,

                              I can definitely look into it further for you.

                              One issue I see is that you are doing the follow : Extend.EndBarsAgo = BarsInProgress;

                              BarsInProgress is used for multi-instrument strategies to pick out which data series is calling the OnBarUpdate() method. What are you trying to assign to Extend.EndBarsAgo?
                              Thanks for looking, Adam; dumb mistake. I replaced BarsInProgress with an integer value of 0 which now draws all the lines to far right of chart

                              Now, next question is what is the syntax to reference startY for each of the IRectangles? I want to add a condition in the foreach loop to only extend rectangles when current price is below the startY value for each IRectangle object. My psuedo-code is:

                              High[0] < startY

                              Thanks again, tremendous help!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              23 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              45 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              22 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              181 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X