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

Drawing a smaller dot?

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

    Drawing a smaller dot?

    Hi all,

    I been trying to find out how can I draw a smaller dot or a triangle on the chart? The standard ones DrawDot() and DrawTriangleUp/Down are just too large and work if you want to have one entry signal drawn under or above the bar. I would like to see several signals to make the best entries. For this smaller dots or triangles

    Anyone know how to draw smaller stuff on charts?

    #2
    Hello,

    Thank you for the question.

    The drawing objects unfortunately can not be changed in size but there is a little trick you can do using a Font rather than a drawing object.

    You can use the Wingdings font to get arrows and then specify a font size. I will provide a couple of examples below.

    This would be an up arrow
    Code:
    DrawText("test", true, "5", 0, Close[0], 0, Color.Red, new Font("Wingdings 3", 20),StringAlignment.Center, Color.Red, Color.Gray, 100);
    This would be an down arrow
    Code:
    DrawText("test", true, "6", 0, Close[0], 0, Color.Red, new Font("Wingdings 3", 20),StringAlignment.Center, Color.Red, Color.Gray, 100);
    The string you see "5" and in the second example "6" are what needs changed to define the arrow. I found a image listing all of the possiblities here:


    The 20 is the font size, this would be where you adjust the size of the arrow.

    You can change the font to any of the wingdings, just name it accordingly in the DrawText();

    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse, I have trouble replicating the above solution in NT8. Would you mind posting how the syntax would have to look like please?

      Comment


        #4
        Hello pennywise,

        Thanks for your note.

        The syntax to draw text is different between NinjaTrader 7 and NinjaTrader 8.

        NinjaTrader 7 DrawText syntax:
        DrawText(string tag, bool autoScale, string text, int barsAgo, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)

        NinjaTrader 8 Draw Text syntax:
        Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, int barsAgo, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)

        This means that you would need to call Draw.Text() and use Brushes instead of Color, as well as using SimpleFont instead of Font.

        For example, the syntax for the first example shared by my colleague Jesse would look something like this in NinjaTrader 8.
        Code:
        Draw.Text(this, "test", true, "5", 0, Close[0], 0, Brushes.Red, new SimpleFont("Wingdings 3", 20), TextAlignment.Center, Brushes.Red, Brushes.Gray, 100);
        See the help guide documentation below to compare the NinjaTrader 8 Draw.Text() method with the NinjaTraer 7 DrawText() method.

        NinjaTrader 7 DrawText(): https://ninjatrader.com/support/help...7/drawtext.htm

        NinjaTrader 8 Draw.Text(): https://ninjatrader.com/support/help.../draw_text.htm

        Let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by pennywise View Post
          Hi Jesse, I have trouble replicating the above solution in NT8. Would you mind posting how the syntax would have to look like please?
          Another solution to control the drawing object size in NT8 would be this: https://ninjatraderecosystem.com/use...rtmarkersplus/

          Comment


            #6
            Does NinjaScript allow use of Wingdings 3? I tried the code in post 4 from BrandonH and got the number 5, not the character for number 5 in Wingdings 3.

            I'd like to make a down triangle with a Wingdings 3 character ("q"), but am having the same problem where the ascii character prints, not the Wingdings character.

            It does seem to work for regular Wingdings, but not Wingdings 3

            thanks

            Comment


              #7
              Hello cre8able,

              Thanks for your notes.

              Yes it is possible to use Wingdings 3 with the Draw.Text() method.

              Wingdings 3 "q" will draw a solid color down arrow on the chart.

              Below is an example of using Wingdings 3 "q" in the Draw.Text() method.

              Code:
              Draw.Text(this, "test", true, "q", 0, Close[0], 0, Brushes.Red, new SimpleFont("Wingdings 3", 20), TextAlignment.Center, Brushes.Red, Brushes.Gray, 100);
              Brandon H.NinjaTrader Customer Service

              Comment


                #8
                hey Brandon

                I get the letter q when i use Windings 3. I used the code you sent.


                Click image for larger version

Name:	image.png
Views:	172
Size:	66.6 KB
ID:	1277814​​
                Attached Files

                Comment


                  #9
                  Hello cre8able,

                  Thanks for your notes.

                  Please see the attached example script demonstrating the code in post # 7 being used.

                  And, see the attached screenshot of the attached script in action.

                  Note that I am testing this on NinjaTrader 8.1.2.0.
                  Attached Files
                  Last edited by NinjaTrader_BrandonH; 11-14-2023, 08:56 AM.
                  Brandon H.NinjaTrader Customer Service

                  Comment


                    #10
                    hey Brandon

                    Same problem

                    I'm using 8.1.1.7 64-bit . I hope that can't be the problem.

                    Click image for larger version

Name:	image.png
Views:	186
Size:	379.7 KB
ID:	1277819

                    Comment


                      #11
                      Hello cre8able,

                      Thanks for your notes.

                      Please update to the current version of NinjaTrader (8.1.2.0) by following the steps below.

                      To update NinjaTrader
                      • Shutdown all programs including NinjaTrader *important
                      • Download NinjaTrader from the link below
                      • Double click the downloaded file to execute it
                      • Follow the on screen instructions
                      • Restart NinjaTrader
                      You can read about changes to this release in the release notes linked below.
                      https://ninjatrader.com/support/help...ease_notes.htm

                      After updating NinjaTrader to the current version, please test the example script shared in post # 9 and report your results.​
                      Brandon H.NinjaTrader Customer Service

                      Comment


                        #12
                        hey Brandon

                        I hoped for NT's sake that the problem wasn't that I was on V8.1.1.7 and you were on 8.1.2

                        I'm now on 8.1.2

                        that wasn't the problem.

                        please help



                        Click image for larger version

Name:	image.png
Views:	148
Size:	483.4 KB
ID:	1277928

                        Comment


                          #13
                          Hello cre8able,

                          Thanks for your notes.

                          To test to see if the behavior is being caused by other addons on your platform, please create a clean environment by following the steps below. Then open a New > Chart window for ES 12-23 1-Minute with no other indicators, custom barstypes, or addons applied to the chart. Import the Wingdings3Test script attached in post # 9, and add the indicator to the chart to see if the behavior persists.

                          Creating a clean environment can be done by following the steps below:
                          1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
                          2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from account.ninjatrader.com
                          3. Add the required indicators and test the template.
                          If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names.

                          For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.​
                          Brandon H.NinjaTrader Customer Service

                          Comment


                            #14
                            thanks Brandon but it's not worth re-installing just to get Wingdings 3.

                            Seems like if Windings works, then Wingdings 3 should work.

                            It's hard to imagine I have some other addon that allows Wingdings to function, but not Wingdings 3.

                            Comment


                              #15
                              Hello cre8able,

                              Thanks for your notes.

                              I see the script working as expected on my end when testing it as seen in the demonstration video below.

                              Demonstration video: https://brandonh-ninjatrader.tinytak...N18yMjM5OTQyNw

                              To narrow in on what might be causing the behavior on your end, please create a clean environment using the steps seen in post # 13 and seen below.

                              In the clean environment, open a New > Chart window for ES 12-23 1-Minute with no other indicators, custom barstypes, or addons applied to the chart. Import the Wingdings3Test script attached in post # 9, and add the indicator to the chart to see if the behavior persists.

                              Creating a clean environment can be done by following the steps below:
                              1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
                              2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from account.ninjatrader.com
                              3. Add the required indicators and test the template.
                              If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names.

                              For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.​​mport the indicator into the clean environment and test to see if the behavior persists.
                              Brandon H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frslvr, 04-11-2024, 07:26 AM
                              9 responses
                              123 views
                              1 like
                              Last Post caryc123  
                              Started by rocketman7, Today, 09:41 AM
                              4 responses
                              15 views
                              0 likes
                              Last Post rocketman7  
                              Started by selu72, Today, 02:01 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by WHICKED, Today, 02:02 PM
                              2 responses
                              16 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by f.saeidi, Today, 12:14 PM
                              8 responses
                              21 views
                              0 likes
                              Last Post f.saeidi  
                              Working...
                              X