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 sjsj2732, Yesterday, 04:31 AM
                0 responses
                39 views
                0 likes
                Last Post sjsj2732  
                Started by NullPointStrategies, 03-13-2026, 05:17 AM
                0 responses
                289 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                289 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                135 views
                1 like
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                96 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Working...
                X