Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Text above the high of the bar

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

    Draw Text above the high of the bar

    I would like to calculate the net change of the bar (Close[0] - Close[1]) and put the result above the high of the bar. Is this possible ?

    Thanks

    #2
    Hi Winnie, yes this is possible. You can use the DrawText method for this and then choose something like High[0] + TickSize as you y value - http://www.ninjatrader-support.com/H.../DrawText.html

    Comment


      #3
      Thanks for your help. I have written the following code but does not show anything.
      double NetChange = (Close[0] - Close[1];
      if (CurrentBar < 3)
      return;
      DrawText("CurrentBar","NetChange",0,High[0] + (TickSize *50),Color.Red");

      Would you point out my mistake ?
      Thanks

      Comment


        #4
        Please try this -
        Code:
        [SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] (CurrentBar < 1[/SIZE][/SIZE][SIZE=2][SIZE=2]) [/SIZE][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2];[/SIZE]
         
        [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2] netChange = (Close[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]] - Close[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]]);[/SIZE]
         
        [SIZE=2]DrawText([/SIZE][/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]"CurrentBar"[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2], netChange.ToString(), [/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2], High[[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]] + (TickSize *[/SIZE][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][SIZE=2]), Color.Red);[/SIZE][/SIZE]
        Also with such a high TickSize multiplier it would easily become invisible because you place it too high then.
        Last edited by NinjaTrader_Bertrand; 03-27-2009, 09:08 AM.

        Comment


          #5
          thanks ! it works now. I know my mistake ! I need to change the double net change value to string type by using the .ToString() method.

          Comment


            #6
            Hi ! I find it works well but it only show the net change above the current bar, could I change it and make it show on every bar.
            Thanks

            Comment


              #7
              Winnie,

              Change your string ID to a unique ID.

              DrawText(CurrentBar.ToString(), ....)
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Perfect ! it works very well and you are very helpful

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                571 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                330 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                548 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                549 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X