Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.ArrowDown()

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

    #16
    Hello Stefan,

    Thanks for writing in.

    Yes, my colleague Paul's ChartMarkerPlus script could be used in a NinjaScript indicator.

    You could use the methods mentioned in post #11 to draw objects with the ChartMarkerPlus DrawingTool. To see the arguments used for these methods, you could type the method in your script and use Intellisense to see the required arguments when hovering your mouse over the method.

    See the sample code below demonstrating drawing a pink dot with a white outline 5 ticks above the close of a bar using DrawPlus.Dotp().

    Code:
    DrawPlus.Dotp(this, "tag1", true, Time[0], Close[0] + 5*TickSize, Brushes.Magenta, 2.5f, Brushes.White);
    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #17
      Hey Brandon,

      thank you for your very fast reply !

      Unfortunately I get an error - see screenshot below- Seems like the new DrawPlus Methods are not available in that class. I'm not sure what I need to do; what do I miss?
      Thx.

      Click image for larger version

Name:	DrawPlusError.jpg
Views:	160
Size:	60.3 KB
ID:	1212002

      Comment


        #18
        Hello Stefan Mayer,

        Thanks for your note.

        I see that you are referencing DrawPlus.DotP() in your script. The draw method should be referenced by calling DrawPlus().Dotp().

        You could view the script by importing it, opening a New > NinjaScript Editor window, opening the Indicator folder, and selecting the ChartMarkersPlusExample script. You could hover the mouse over the DrawPlus.Dotp() method in the NinjaScript Editor to see the arguments required for the method using IntelliSense.

        See the attached example script demonstrating how to use the sample code from post #16 in a NinjaScript indicator.

        Let me know if I may assist further.
        Attached Files
        Last edited by NinjaTrader_BrandonH; 08-15-2022, 08:11 AM.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #19
          Paul,
          When trying to remove the ChartMarkerPlus objects do we use the default RemoveDrawObject?
          Thank you for your time.
          James

          Comment


            #20
            Hello James,

            Thanks for your notes.

            Yes, since ChartMarkersPlus is a DrawingTool script you could use RemoveDrawObject() to remove the draw object from the chart.

            See the help guide documentation below for more information.

            RemoveDrawObject(): https://ninjatrader.com/support/help...drawobject.htm
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #21
              Good Morning,
              Again, thank you for your help with learning to create indicators.
              I'm trying to have a dot plot when a condition is true on the bar in progress and also if that condition turns false during the same bar in progress to remove the dot. This is what I got but I can't seem to get the dot to remove. It will plot if the condition is true but if it changes it does not remove the object. Is it possible to let me know what I am missing?
              Thank you again for your time. The code is posted below.
              James

              if ((GomOrderFlowProValues1.IsBuyingReversal[0] == 1))

              {
              ExhUp = true;
              DrawPlus.Dotp(this, @"exhUp", true, 0, (Low[0] + ( ofexh_offset*TickSize )) , ofexhColor, (float)exhSize, ofexhoColor);
              }

              if ((ExhUp == true)
              && (GomOrderFlowProValues1.IsBuyingReversal[0] == 0) )


              {
              ExhUp = false;
              RemoveDrawObject(@"exhUp");
              }

              ExhUp = false;
              ExhDn = false;

              Comment


                #22
                Hello James,

                Thanks for your notes.

                To clarify, are you running your script with Calculate mode Calculate.OnBarClose?

                If so, the OnBarUpdate() logic would only process at the close of a bar when the condition to remove the drawn object is true.

                You may consider having your indicator run with Calculate.OnPriceChange if you want OnBarUpdate() logic processed intrabar. With Calculate.OnPriceChange, the OnBarUpdate() logic would process for each price change.

                Calculate: https://ninjatrader.com/support/help.../calculate.htm

                For the tag name of the DrawPlus.Dotp() method, I suggest using "exhUp" instead of @"exhUp". Then use that tag name when calling RemoveDrawobject().

                Attached is a simple example script demonstrating drawing a dot with DrawPlus.Dotp() on the chart and removing the drawn object. The way the script works is when the Close[0] price is greater then the Open[0] price, a dot is drawn on the chart. When the Close[0] price is less than the Open price, the dot drawn on the chart is removed. Note that Calculate.OnPriceChange is used to process OnBarUpdate() logic intrabar.

                Further, debugging prints should be added to the script to understand exactly how your logic is behaving.

                Below is a link to a forum post that demonstrates how to use prints to understand behavior.
                https://ninjatrader.com/support/foru...121#post791121
                Attached Files
                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                Comment


                  #23
                  Thank you for the example, Brandon.
                  I think it was the @ that was causing the issue.
                  If I want to show all the history of the condition would I just add the + Convert.ToString(CurrentBars[0] to the dot plot tag?


                  Comment


                    #24
                    Hello James,

                    Thanks for your notes.

                    If you want to have a dot drawn historically instead of being updated each time the Draw method is called, you could give the Tag name a unique name such as "exhUp" + CurrentBar.

                    From the help guide: "if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."

                    Draw.Dot(): https://ninjatrader.com/support/help...8/draw_dot.htm

                    Note that you would need to make sure you are supplying the exact tag name of the draw object you want to remove when calling RemoveDrawObject() so that specific draw object is removed from the chart.
                    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                    Comment


                      #25
                      Thank you Brandon again for all your help.
                      The example and direction have helped tremendously.
                      I do have another question regarding the opacity of the objects. I see that rectangles have opacity but objects do not.
                      Is there an easy way to add Opacity to the ChartMarkerPlus objects?

                      Again thank you for your help. Happy Holidays.
                      James

                      Comment


                        #26
                        Hello James,

                        Thanks for your notes.

                        Draw objects such as Draw.Dot() in NinjaScript do not have an opacity parameter available to set.

                        This is also true for the ChartMarkerPlus DrawPlus.Dotp() method.

                        A few of the Draw objects available that allow you to specify an opacity is Rectangle, Triangle, and Ellipspe.

                        You could consider adding draw objects to a chart window, double-clicking on the draw object, and noting the properties that draw object has available in the Drawing Objects window.

                        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                        Comment


                          #27
                          Thanks again Brandon for your quick reply.
                          I have a question regarding the ChartMarkersPlus. If you size them through ninjascript (code) is there a way to have them auto-size when zooming in? It seems they don't resize with the bar if they have a size associated with them.
                          Thanks again.
                          James

                          Comment


                            #28
                            Hello James,

                            Thanks for your notes.

                            There would not be a way to have the draw object drawn by the ChartMarkersPlus increase in size when you zoom in on a chart window.

                            Unfortunately, ChartMarkerPlus drawn objects do not have this ability.
                            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                            Comment


                              #29
                              Thanks again, Brandon.
                              Have a great Holiday.
                              James

                              Comment


                                #30
                                Hello Brandon,
                                I have a question regarding the ChartMarkersPlus. When exporting my custom indicator, I assume I need to add it to the export. I am getting an error stating that not all the required components are included. Is there a reference for the ChartMarkersPlus? If not, do you know how to track down the issue?
                                Thanks again for all your time and help.
                                James

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                646 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                367 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                107 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                569 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                573 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X