Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawTriangleDown/UP size

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

    DrawTriangleDown/UP size

    Hello Support and All,

    Is there a way to increase the size of the triangle in the DrawTriangleDown/Up comand?

    Thanks

    #2
    Hello outsource,

    Thank you for writing in. There is not currently a documented way to increase the size of a triangle drawn using the DrawTriangleUp/Down methods. I would recommend creating a custom method to accomplish this inside the Plot override.

    Please let me know if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      You can use DrawText() with the font Webdings. Characters "5" and "6" will show as triangles.

      DrawText() allows for adjusting the font size, which translates into differrent sizes for the triangles.

      Comment


        #4
        Originally posted by Harry View Post
        You can use DrawText() with the font Webdings. Characters "5" and "6" will show as triangles.

        DrawText() allows for adjusting the font size, which translates into differrent sizes for the triangles.
        Thanks,Harry,

        could you please give an example?for the simple condition like this,for e.g.:

        if(Low[0] < Open[0] && Close[0] > Open[0])

        DrawText()

        Thanks

        Comment


          #5
          Code:
          #region Variables
          private string                     triangleStringUp               = "5";
          private string                     triangleStringDown           = "6";
          private Font                       triangleFont                    = null;
          private int                         triangleFontSize              = 18;            
          #endregion
          
          
          protected override void OnStartUp()
          {
                 triangleFont = new Font("Webdings", triangleFontSize);
          }
          
          protected override void OnBarUpdate()
          {
                 DrawText("BearTrigger" + CurrentBar, true, triangleStringDown, 0, High[0] +        
                 offset, triangleDownColor, triangleFont, pixelOffset, StringAlignment.Center,  
                 Color.Transparent, Color.Transparent, 0);
          }
          You also need to declare variables for the offset and the triangleDownColor.

          If you wish to adjust the size of the triangle you would need to create a property for the triangleFontSize.
          Last edited by Harry; 10-19-2015, 07:39 AM.

          Comment


            #6
            Originally posted by Harry View Post
            Code:
            #region Variables
            private string                     triangleStringUp               = "5";
            private string                     triangleStringDown           = "6";
            private Font                       triangleFont                    = null;
            private int                         triangleFontSize              = 18;            
            #endregion
            
            
            protected override void OnStartUp()
            {
                   triangleFont = new Font("Webdings", triangleFontSize);
            }
            
            protected override void OnBarUpdate()
            {
                   DrawText("BearTrigger" + CurrentBar, true, triangleStringDown, 0, High[0] +        
                   offset, triangleDownColor, triangleFont, StringAlignment.Center, Color.Transparent, 
                   Color.Transparent, 0);
            }
            You also need to declare variables for the offset and the triangleDownColor.

            If you wish to adjust the size of the triangle you would need to create a property for the triangleFontSize.
            I got errors - 'no overload takes 11 arguments'...Is that b/c you put Color.Transparent twice?

            Comment


              #7
              Originally posted by outsource View Post
              I got errors - 'no overload takes 11 arguments'...Is that b/c you put Color.Transparent twice?
              Forgot the pixelOffset. You can look up the exact syntax in the NinjaTrader Help Files. Just search for 'DrawText'. It is all explained.

              Comment


                #8
                Hello outsource,

                The help guide document can be found here: http://ninjatrader.com/support/helpG...htsub=drawtext

                The overload being used is the following:
                Code:
                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)
                An update to Harry's example might be:
                Code:
                DrawText("BearTrigger" + CurrentBar, true, triangleStringDown, 0, High[0] + TickSize * 2, 5, Color.Red, triangleFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                Please let me know if I may be of further assistance.
                Michael M.NinjaTrader Quality Assurance

                Comment


                  #9
                  Originally posted by NinjaTrader_MichaelM View Post
                  Hello outsource,

                  The help guide document can be found here: http://ninjatrader.com/support/helpG...htsub=drawtext

                  The overload being used is the following:
                  Code:
                  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)
                  An update to Harry's example might be:
                  Code:
                  DrawText("BearTrigger" + CurrentBar, true, triangleStringDown, 0, High[0] + TickSize * 2, 5, Color.Red, triangleFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
                  Please let me know if I may be of further assistance.
                  Hi,Michael,

                  always have difficulty to read the HelpGuides.How to know which,and how many,elements are required?It seem like always different.How i know i read it properly?

                  Thanks

                  Comment


                    #10
                    Originally posted by outsource View Post
                    Hi,Michael,

                    always have difficulty to read the HelpGuides.How to know which,and how many,elements are required?It seem like always different.How i know i read it properly?

                    Thanks
                    It depends on what you are trying to accomplish.

                    Comment


                      #11
                      Originally posted by sledge View Post
                      It depends on what you are trying to accomplish.
                      Hi,Sledge,

                      i`m trying to become God

                      Seriously,what i`m trying to accomplish?And how the HelpGuide can be helpful.It provides with examples that lack of the additional elements you want to insert.And when you insert them,you,occasionally, get errors.

                      Comment


                        #12
                        Originally posted by outsource View Post
                        Hi,Michael,

                        always have difficulty to read the HelpGuides.How to know which,and how many,elements are required?It seem like always different.How i know i read it properly?

                        Thanks
                        You just need to copy and paste what is shown on the help file. It is not that difficult to do.

                        For the NinjaScript Draw() methods there are several overlaods.

                        This means that you can select the overload that fits your purpose and use it accordingly.

                        You have the choice which overload to copy and paste!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Jonafare, 12-06-2012, 03:48 PM
                        5 responses
                        3,985 views
                        0 likes
                        Last Post rene69851  
                        Started by Fitspressorest, Today, 01:38 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Fitspressorest  
                        Started by Jonker, Today, 01:19 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Jonker
                        by Jonker
                         
                        Started by futtrader, Today, 01:16 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post futtrader  
                        Started by Segwin, 05-07-2018, 02:15 PM
                        14 responses
                        1,792 views
                        0 likes
                        Last Post aligator  
                        Working...
                        X