Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawLine question

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

    DrawLine question

    Hi Support,

    In Ninjascript there is a DrawLine function to draw lines.

    DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)

    On a chart,which has some blank space before the right margin,how does one drawlines using ninjascript? Should one use negative values for DrawLine function?

    DrawLine("tag1", false, -30, 695, -10, 695, Color.LimeGreen, DashStyle.Dot, 2);

    So, that lines look like this:


    Thanks
    PatientTrader

    #2
    Unfortunately you cant do that with the DrawLine function. DrawLine draws to the right of price but also all the way to the left of the chart too. You can try DrawText which will allow you to use that area to the right and maybe use dashes for a line. Vertical alignment is more of a problem though.
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Thanks eDanny for suggesting the alternative.

      Kind of surprised to know that it can't be done in ninjascript,when one can do it manually on the chart by clicking F2. Can anyone from ninja tech support confirm this please.

      Would like to request this feature in Ninja 7, if it cannot be done in Ninja 6.5

      Thanks
      Patienttrader

      Comment


        #4
        Unfortunately you cannot draw into the future programmatically.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          Not sure if I asked the question correctly, wanted to clarify I am not trying to draw lines in future chart space(where bars get printed). I am just trying to draw a line at the end of the right margin. In the chart properties,I have right margin set as 150. The right margin doesn't get changed or affected when new bars are printed in the future correct. So we can't draw the line at the end of right margin (which remains the same) from what I understand.

          Thanks
          PatientTrader

          Comment


            #6
            Guess I do not follow. The end of the right margin would just be the most recent bar. You can draw on the most recent bar with barsAgo index of 0.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              Sorry for late reply. Just to clarify my question, trying to find out if anyway in ninjascript, one can draw lines in right margin section using ninjascript. Like this:



              Thanks
              PatientTrader

              Comment


                #8
                Unfortunately you cannot draw in the right side margin with NinjaScript. You can extend horizontal lines and things like that into that region, but you cannot draw any anchor points there.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh,

                  Sorry to hear that. Would one be able to that in ninjascript in upcoming Ninja 7? I request the devlopment team to consider enabling the right margin drawing feature(in ninjascript).

                  Thanks
                  PatientTrader

                  Comment


                    #10
                    Originally posted by PatientTrader View Post
                    Josh,

                    Sorry to hear that. Would one be able to that in ninjascript in upcoming Ninja 7? I request the devlopment team to consider enabling the right margin drawing feature(in ninjascript).

                    Thanks
                    PatientTrader
                    You can try attached.
                    It will draw 12 predefined short lines in margin with text label
                    Attached Files
                    Last edited by roonius; 04-06-2009, 05:53 PM.

                    Comment


                      #11
                      Thanks Roonius. Appreciate it.

                      Anyway, the dashstyle/width of the line(like dash/dot or thickness 2,3..) can be adjusted after loading the indicator on a chart? or it has to be hardcoded in the ninjascript?

                      Thanks
                      PatientTrader
                      Last edited by PatientTrader; 04-06-2009, 06:40 PM.

                      Comment


                        #12
                        Originally posted by PatientTrader View Post
                        Thanks Roonius. Appreciate it.

                        Anyway, the thickness/style of the line(like dash/dot or thickness 2,3..) can be adjusted after loading the indicator on a chart? or it has to be hardcoded in the ninjascript?

                        Thanks
                        PatientTrader
                        In this version you can change the color for each separate line and font for all of them.
                        If you want additional options, you will have to play with the code.

                        Comment


                          #13
                          DrawHorizontalLine("Line",line1Value,LineColor,Hor izLineStyle,line_Size); //value 850

                          DrawHorizontalLine("Line",line2Value,LineColor,Hor izLineStyle,line_Size); // value 840
                          DrawHorizontalLine("Line",line3Value,LineColor,Hor izLineStyle,line_Size); // value 830
                          DrawHorizontalLine("Line",line4Value,LineColor,Hor izLineStyle,line_Size); // value 820


                          Hi, it draws only line 820, what happen to other lines?
                          Attached Files
                          Last edited by nkhoi; 04-22-2009, 05:53 PM.

                          Comment


                            #14
                            Originally posted by nkhoi View Post
                            DrawHorizontalLine("Line",line1Value,LineColor,Hor izLineStyle,line_Size); //value 850

                            DrawHorizontalLine("Line",line2Value,LineColor,Hor izLineStyle,line_Size); // value 840
                            DrawHorizontalLine("Line",line3Value,LineColor,Hor izLineStyle,line_Size); // value 830
                            DrawHorizontalLine("Line",line4Value,LineColor,Hor izLineStyle,line_Size); // value 820


                            Hi, it draws only line 820, what happen to other lines?
                            You are using the same tag "Line". Use different tags like "Line1", "Line2", etc.

                            Comment


                              #15
                              it works, thanks.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by TraderIqbal, 10-20-2023, 10:12 AM
                              3 responses
                              123 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by cmtjoancolmenero, Yesterday, 05:05 PM
                              1 response
                              27 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by vitaly_p, Yesterday, 05:09 PM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by Taddypole, Yesterday, 02:25 PM
                              2 responses
                              14 views
                              0 likes
                              Last Post Taddypole  
                              Started by TraderJA, Today, 12:06 AM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X