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 stop drawing Draw.Rectangle()

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

    #16
    Paul,
    Wow, Thanks, it works! Now I can add some variables, other parameters, and MA's.

    One more question, Now is it possible to make the uplev store for each Draw.Rectangle and not reset on each startBar. This way if the spread is falling, it dose not stopDrawing the Draw.Rectangle once a new uplev is created at a lower level? Hope you can follow that?

    I'm thinking I will have to link the Drawing Tag to the uplev, but not sure how to do this.

    Thanks, Woody.

    Comment


      #17
      Hello woodyfox,

      Thanks for your reply.

      I'm not sure I understand what you are wanting to do but to answer your question, yes you can store values into variables at any time. You could store the values used when the condition if (Close[0] > Upper[0]) becomes true because at that point the rectangle has ended and the variables uplev and lowlev are still as last drawn.
      Paul H.NinjaTrader Customer Service

      Comment


        #18
        Paul,
        Thanks for getting back with me. The image below will show my ultimate goal? But what you have helped me with so far is way much better than user drawn!

        If I could get the Draw.Rectangle to stopDrawing at the uplev and not the Upper[0], that is my first problem to solve. The Second problem is getting the Draw.Rectangle to Draw a second,third,etc. while still under a previous condition.

        Maybe both are easy solutions? Your guidance has been so helpful.
        Thanks, Woody.

        Comment


          #19
          Hello woodyfox,

          Thanks for your reply.

          If you want the rectangle to stop when close[0] is above the uplev that seems easy enough, right? Just replace Upper[0] with uplev in the statement: if (Close[0] > Upper[0])

          To have multiple dynamic rectangles can be a bit complex and is beyond the level of support we can provide. We have provided support for how to create a dynamic rectangle which is the ninjascript part, the ability to control the code to manage multiple ones would be more of a C# coding question.

          If you are unable to work out the coding, please let us know if we can provide references to 3rd party coders who would be able to tackle your indicator development.
          Paul H.NinjaTrader Customer Service

          Comment


            #20
            Paul,
            I tried the uplev in place of Upper[0]? I did not think it worked, but now I realize there were way fewer Rectangle's drawn and did not scroll back to see them? Careless?

            Is there an example of multiple Dynamic Rectangles in the Forum?
            Can it be done under OnBarUpdate?
            Yes could you send me the list of third party coders.

            Thanks for all you help, Woody.

            Comment


              #21
              Paul,
              I tried the uplev in place of Upper[0]? I did not think it worked, but now I realize there were way fewer Rectangle's drawn and did not scroll back to see them? Careless?

              Also, if I Reverse the Condition and use lowlev in place of Lower[0], Nothing Plots.
              Any suggestions on that?



              Is there an example of multiple Dynamic Rectangles in the Forum?
              Can it be done under OnBarUpdate?
              Yes could you send me the list of third party coders.

              Thanks for all you help, Woody.

              Comment


                #22
                Hello woodyfox,

                Thanks for your replies.

                I will ask our business group to respond to your request for 3rd party coders.

                Here is a link to an indicator that draws multiple rectangles, in OnBarUpdate: https://ninjatrader.com/support/foru...d=7&linkid=705

                If your code is not working with the changes you made, this is the time to start debugging your code. For help with this, please see: https://ninjatrader.com/support/foru...ead.php?t=3418
                Paul H.NinjaTrader Customer Service

                Comment


                  #23
                  Hello woodyfox,

                  You can search our extensive library of vendors who provide programming services 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


                    #24
                    Paul,
                    I'm trying to debug the code as you suggested. I stared with my if statement, and the output window is displaying lots of zero's as you can see below.
                    Sorry what could be a trivial question, but although it is printing the correct entered if statement, should I still be getting zero's to print?

                    Comment


                      #25
                      Hello woodyfox,

                      Without the full code we're unable to test on our end.

                      If you'd like to upload the full code I can take a look and see if anything jumps out. Or if you'd prefer to email a copy, send to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and the files.

                      I look forward to your reply.
                      Alan P.NinjaTrader Customer Service

                      Comment


                        #26
                        Alan,
                        Thanks Alan, I have attached the code.
                        Attached Files

                        Comment


                          #27
                          Hello woodyfox,

                          I tested the script on a few different instruments and time frames and was unable to replicate the zero prints you have.

                          I would confirm you do not have another indicator applied to an open chart which is printing zeros, as it doesn't look like those would come from the script you uploaded.

                          Please let us know if you need further assistance.
                          Attached Files
                          Alan P.NinjaTrader Customer Service

                          Comment


                            #28
                            Alan, Sorry I left one other indicator on my chart. I'm a rookie!

                            Could you check the attached code on your end.
                            Its the reverse of the last one, except I can not get the lowlev to print?
                            Attached Files

                            Comment


                              #29
                              Hello woodyfox,

                              Lowlev looks to be set to the data series Lower, which is an EMA based off the lows. The if statement associated with printing the value of lowlev,

                              Code:
                              if (High[0] < lowlev)
                              If you are not seeing prints its likely because the high is not lower than lowlev, which seems logical given what the value of lowlev is set to a series which averages low prices.

                              I might suggest putting the following print statement above the if statement and checking the prints to debug,

                              Code:
                              Print(lowlev.ToString() +”:”+ High[0].ToString());
                              Please let us know if you need further assistance.
                              Alan P.NinjaTrader Customer Service

                              Comment


                                #30
                                Alan, if I use a print statement after if (firstBar) the Rectangles Draw. If I omit it, they do not?
                                Any Suggestions what is going on?

                                if (firstBar)
                                Print(Upper[0].ToString() + ":" + Lower[0].ToString());

                                Thanks, Woody.
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by CortexZenUSA, Today, 12:53 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post CortexZenUSA  
                                Started by CortexZenUSA, Today, 12:46 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post CortexZenUSA  
                                Started by usazencortex, Today, 12:43 AM
                                0 responses
                                5 views
                                0 likes
                                Last Post usazencortex  
                                Started by sidlercom80, 10-28-2023, 08:49 AM
                                168 responses
                                2,266 views
                                0 likes
                                Last Post sidlercom80  
                                Started by Barry Milan, Yesterday, 10:35 PM
                                3 responses
                                13 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Working...
                                X