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

Looking for Horizontal Line with Label on Y-axis

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

    Looking for Horizontal Line with Label on Y-axis

    Looking for a tool to plot a horizontal line with a price label that plots on the y-axis.
    The features I look for are

    a) being able to use a hotkey
    b) once on the chart, being able to drag it
    c) it plots the label on the Y-axis

    Similar to: Horizontal-Line Label by ninZa.co (see screenshot) but then it should plot on Y-axis. If you know of a paid version, please let me know.
    Attached Files

    #2
    Hello HansK,

    Thank you for your post.

    To have a movable line, a line drawing object must be used which does not have the ability to create a plot label on the price margin.

    What could be done is after the line is drawn, a check for the price of the object is plotted to a plot which only plots on the last bar (unsets all the previous bars). This would create the plot label.

    There is an indicator written by a forum member that gets close to this but does not actually plot in the price margin. It does label the price on the line itself, however.
    http://www.ninjatrader.com/support/f...php?t=48872#36

    With a small edit, a plot can be added and the lineInfo.linePrice can be set to the plot, and if the previous bar of the plot is set, unset this.

    To add a plot:
    Add(new Plot(Color.Blue, "myPlot"));
    http://www.ninjatrader.com/support/h...es/nt7/add.htm

    To check if a plot is set:
    if (Value.ContainsValue(1))
    http://www.ninjatrader.com/support/h...ries_class.htm - (find the conjoined word containsvalue)

    To unset a plot:
    Value.Reset(1)
    http://www.ninjatrader.com/support/h...ries_class.htm - (find the word reset on the page)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by HansK View Post
      Looking for a tool to plot a horizontal line with a price label that plots on the y-axis.
      The features I look for are

      a) being able to use a hotkey
      b) once on the chart, being able to drag it
      c) it plots the label on the Y-axis

      Similar to: Horizontal-Line Label by ninZa.co (see screenshot) but then it should plot on Y-axis. If you know of a paid version, please let me know.
      The reason I don't put labels on the y-axis is because if a user chooses a rather big font size , printing labels on y-axis will look ugly
      ninZa
      NinjaTrader Ecosystem Vendor - ninZa.co

      Comment


        #4
        Well, it is as you say : IF a user chooses....
        I would defenitly choose to have price on the price-axis. In short: making it optional.
        Appreciate your free version. Thanks

        Comment


          #5
          I will have a look at your suggestion in the weekend but I am pretty sure this is beyond my skills. Thanks for your advice, Chelsea.

          Comment


            #6
            Hello HansK,

            Typically, NinjaTrader Platform Support does not create or modify code for clients (except for limited helpful examples).

            However, I think this would be a good project for one of our newer members of support for additional practice at understanding NinjaScript.

            I have forwarded this forum thread to one of our newest members who may be creating this for you in their own time.

            Do keep in mind, this is not a service that NinjaTrader Support provides.

            Also, I am including a list of professional NinjaScript Constants below, who would be happy to create this or other indicators at your request.
            http://ninjatraderecosystem.com/Part...ultants.php#813
            JaredNinjaTrader Ecosystem

            Comment


              #7
              Hello,

              I've edited the indicator linked in Chelsea's post to include a Y-axis price label that is pegged to the horizontal line. In the attached code, I've simply added a plot in the Initialize() method, then added the following line into the Plot() override:

              Value.Set(l1.Y);

              This takes the current Y value of the horizontal line on the chart, then sets the value of the plot to this value every time the Plot() method is called.

              Please let me know if I can assist further.
              Attached Files
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Thank you for doing this guys! Really appreciate this. As it now displays a price label on the Y-axis, would it be possible to have an option not to show the label that is inside the chart? Or to make that text really, really small or black (like background)?
                Attached Files
                Last edited by HansK; 02-03-2015, 05:38 AM.

                Comment


                  #9
                  Label disappears after 1 second

                  When I plot a line the label on the y-axis disappears after 1 second if I have DH_HorizPriceLine on my chart. Really strange.
                  Attached Files
                  Last edited by HansK; 02-03-2015, 09:54 AM.

                  Comment


                    #10
                    Hello HansK,

                    What is the DH_HorizPriceLine indented to do?

                    With the name, it looks like it is purposefully finding a horizontal line and attempting to control this. That could cause issues since the indicator modified by NinjaTrader_Dave uses a horizontal line.

                    Also, with the label that is appearing on the line in the indicator modified by NinjaTrader_Dave you would need to delete the code that does this.

                    Remove the line that starts with graphics.DrawString on line 211 should stop the label from being added above the line.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Chelsea, the DH_HorizPriceLine gives you a plot of the last traded price. So basically its an easy way to see where price exactly is compared to a previous swing low/high.

                      Ok I will delete the 211 code line. Thanks for your support!
                      Attached Files

                      Comment


                        #12
                        Hi HansK,

                        I took a look at the indicator NinjaTrader_Dave has made and tested this with most of the default indicators supplied with NinjaTrader and I was not able to reproduce this behavior.

                        I recommend that you contact the author of the DH_HorizPriceLine script and let them know that this is causing an issue with another indicator.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Chelsea, if you were to look in the DH_HorizPriceLine I made many years ago you would see there is nothing in it to conflict with anything. OnBarUpdate() has only two lines and it uses four variables:
                          CurrentPrice = Close[0];
                          DrawHorizontalLine("CurrentPrice", false, CurrentPrice, MyColor, MyLine, lineThickness);

                          No enums or anything in there.

                          Dan
                          eDanny
                          NinjaTrader Ecosystem Vendor - Integrity Traders

                          Comment


                            #14
                            Hello HansK,

                            May I have a copy of the DH_HorizPriceLine you are using so that I may try and reproduce the issue?

                            I would like the exact copy you are using in case there have been any modifications.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Here it is
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by FrazMann, Today, 11:21 AM
                              2 responses
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by rjbtrade1, 11-30-2023, 04:38 PM
                              2 responses
                              80 views
                              0 likes
                              Last Post DavidHP
                              by DavidHP
                               
                              Started by Spiderbird, Today, 12:15 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by lorem, Yesterday, 09:18 AM
                              5 responses
                              18 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              12 responses
                              42 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X