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 Arrows and Text in Price or Indicator area

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

    Drawing Arrows and Text in Price or Indicator area

    I have created an indicator that I want to use DrawArrowUp, DrawArrowDown and DrawText to alert me to a condition where I want to enter a trade. When I use the Draw functions they print in the indicator area. I would like to print them in the price area with the price bars. How do I get the Draw functions to print in the price area?

    #2
    Bob, you could work with DrawOnPricePanel for this - http://www.ninjatrader-support.com/H...ceOnPanel.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand, that worked.

      I have another question. How can I set the font to Arial 8 point bold?

      Comment


        #4
        Great - you would need to use the extended DrawText overload offering a font parameter - http://www.ninjatrader-support.com/H.../DrawText.html
        BertrandNinjaTrader Customer Service

        Comment


          #5
          This is what I m using

          private Font textFont = new Font("Arial", 8);

          DrawText(CurrentBar.ToString() + "c", true, Open[0].ToString(), 0, High[0] + TickSize * 10, Color.HotPink, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);

          How do I make the font bold?

          Comment


            #6
            You could try this -

            Code:
             
            private Font textFont = new Font("Arial", 8, FontStyle.Bold);
            BertrandNinjaTrader Customer Service

            Comment


              #7
              That did it. Thanks

              Comment


                #8
                I have a question about arrow and text placement. How is the location for the arrow and text figured?

                I have seen examples using TickSize for placement on the price panel but the arrow seems to take a variable amount of ticks depending on what I am trading. The following code places the text just above the arrow on ES. For example the high is 1099.75, the point of the down arrow is 1100.25, the top of the arrow is 1101.25 and the bottom of the text is 1101.25 so the text is 10 ticks above the high. On TF I have a high of 621.7, the bottom of the arrow is 621.8, the top of the arrow is 622.0 and the bottom of the text is 622.3. That is only 6 ticks.

                DrawArrowDown(CurrentBar.ToString() + "b", true, 0, High[1] + TickSize, Color.HotPink);
                DrawText(CurrentBar.ToString() + "c", true, Open[0].ToString(), 0, High[0] + TickSize * 10, Color.HotPink, textFont, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);

                I would also like to know what unit of measure is used for placement in the indicator panel.

                Thanks
                Last edited by BobTN; 02-25-2010, 12:40 PM.

                Comment


                  #9
                  BobTN,

                  It goes by the tick size of the instrument. A tick for the ES is 0.25 while a tick for TF is 0.10. These are defined in your Instrument Manager for each instrument.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks. You are correct. I found a coding error. I was using High[0] when I meant to use High[1].

                    Both of you have been very helpful. I just have one more question and then I swear I will leave you alone... at least until I have my next coding challenge. LOL

                    Is there any way to make the arrow wider for the DrawArrowUp or DrawArrowDown?

                    Comment


                      #11
                      You're welcome Bob, unfortunately not possible directly, best option is just to plot for example two arrows above / below eachother to arrive at a larger drawing.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        I am still having problems. I am using the following code

                        DrawOnPricePanel = true;

                        DrawArrowUp(CurrentBar.ToString() + "l", true, 0, Low[1] - TickSize, Color.PaleGreen);

                        DrawText(CurrentBar.ToString() + "m", Open[0].ToString(), 0, Low[1] - 8 * TickSize, Color.PaleGreen);

                        The arrows draw in the price panel but the text is in the indicator area. What am doing wrong?

                        Comment


                          #13
                          I found the problem. The thread at



                          took me to a NinjaTrader problem. In my case somehow the default workspace got set to <panel>1<panel>. When I changed it to <panel>0<panel> my text appeared on the price panel.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by nandhumca, Today, 03:41 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post nandhumca  
                          Started by The_Sec, Today, 03:37 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post The_Sec
                          by The_Sec
                           
                          Started by GwFutures1988, Today, 02:48 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_Clayton  
                          Started by ScottWalsh, 04-16-2024, 04:29 PM
                          6 responses
                          33 views
                          0 likes
                          Last Post ScottWalsh  
                          Started by frankthearm, Today, 09:08 AM
                          10 responses
                          36 views
                          0 likes
                          Last Post frankthearm  
                          Working...
                          X