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

Can I draw an arrow that stays on the top or bottom of a price chart?

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

    Can I draw an arrow that stays on the top or bottom of a price chart?

    I am working on an indicator that draws an arrow with some text on the chart at a candle. Right now, I am calculating the lowest and highest of all of the prices and indicators (MAs and Bollinger Bands) at that bar and drawing the arrow a few pixels below or above those prices. This works but it is not pretty and the spacing varies extremely when I switch from higher "priced" instruments (like ^DJIA) to cheaper ones (like JASO).

    Is there any way that I can place an arrow and text on or near the bottom (and top) edges of the price panel and have it stay in the same relative place no matter how the chart is scaled? I want the arrow to point to a specific, calculated candle but to sit on the bottom or top margin no matter how I scroll the x-axis or scale the vertical axis. I have searched all over this site and also in other indicators but I just cannot find this. I have found a few kernels of ideas, but I am stumped. If there is a property that displays the Y-axis min and max, I think that would work... I just cannot find it.

    Thanks in advance...

    #2
    Hi atangram,

    First off, welcome to the NinjaTrader Support Forums. Unfortunately you cannot set the location of the arrow and text in the manner you want. The drawn arrow requires a certain y-value that correesponds with the y-axis and will move away if your y-axis moves too far. For text, you can use DrawTextFixed(), but that will just have an overlay text not correlated with your signal bar. It will just have a string of text sitting at whatever position you wanted.

    You can try overriding the Plot() method, but this is unfortunately too advanced programming that is outside the scope of what we can offer support for.
    Last edited by NinjaTrader_JoshP; 10-02-2008, 11:51 AM.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh, Thanks for the quick reply. I will try to override the Plot() function but I still need to know the y-scale min and max values. Can you give me a little hint on where that property lives? Or even better, can you point me to an indicator that uses this property?

      Comment


        #4
        Hi atangram,

        The closest thing I can direct you to would be the CustomPlotSample preinstalled with your NinjaTrader as an indicator. Unfortunately I cannot provide more support than that on this endeavour. Good luck.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I know this is an old thread, but I believe I have exactly this same question. Maybe NT 7 has a solution to this?

          I want to put an arrow corresponding to a specific bar on top of the chart panel. Basically, instead of

          DrawTriangleUp("My dot" + CurrentBar, true, 0, High[0], Color.Green);

          it would be something like

          DrawTriangleUp("My dot" + CurrentBar, true, 0, Top_of_frame, Color.Green);


          This would make it so that if I y axis, the triangle is always visible at the top of the chart.

          If it is possible to do that, then is it possible to "stack them". Let's say I had two indicators, and I wanted one to be underneither the other, is that possible? How?

          Thanks,
          Matt

          Comment


            #6
            Matt,

            To do this still requires the use of the Plot() method.

            Alternatively, you could try using DrawTextFixed() while using a font like Wingdings to draw some triangles. Those would be locked on the chart either on top or bottom of the panel. If you have multiple indicators that require stacking, you would need to add some enter lines to space them out so they don't overlap.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh for your quick response.

              However, I require that the arrow or ^ or v to be directly over a specific bar. The DrawTextFixed does not allow you to position text in that manner, see below.
              Any other ideas?

              Thanks,
              Matt

              DrawTextFixed(string tag, string text, TextPosition textPosition)

              TextPosition
              TextPosition.BottomLeft
              TextPosition.BottomRight
              TextPosition.Center
              TextPosition.TopLeft
              TextPosition.TopRight

              Comment


                #8
                Matt,

                You will then have to override the Plot() method.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Drawtext fixed

                  Hi Josh can you please elaborate on this:

                  "Alternatively, you could try using DrawTextFixed() while using a font like Wingdings to draw some triangles. Those would be locked on the chart either on top or bottom of the panel. If you have multiple indicators that require stacking, you would need to add some enter lines to space them out so they don't overlap. "

                  I am using drawtextfixed on top right corner of the hart. I want to put more text down underneath. Here is the text as an example:

                  DrawTextFixed("Deltapos1", (GomDeltaVolume().UpVolume[0] + GomDeltaVolume().DownVolume[0]).ToString(), bPosition, Color.White, textFontMed, Color.Black, Color.Lime, 10);

                  So how would I put this on line 2 on top right of the chart? Thanks. DJ

                  Comment


                    #10
                    djkiwi, when creating the string you wish to display, please include a line break that separetes the top line from the bottom line. To include a line break, please add this to your string at the appropriate location:
                    Code:
                    "/r/n"
                    /r/n is the set of characters that will include a line break in your string.

                    Please let us know if you have any other questions.
                    AustinNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by swestendorf, Today, 11:14 AM
                    2 responses
                    5 views
                    0 likes
                    Last Post NinjaTrader_Kimberly  
                    Started by xiinteractive, 04-09-2024, 08:08 AM
                    4 responses
                    12 views
                    0 likes
                    Last Post xiinteractive  
                    Started by Mupulen, Today, 11:26 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post Mupulen
                    by Mupulen
                     
                    Started by Sparkyboy, Today, 10:57 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by TheMarlin801, 10-13-2020, 01:40 AM
                    21 responses
                    3,917 views
                    0 likes
                    Last Post Bidder
                    by Bidder
                     
                    Working...
                    X