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

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
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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 Belfortbucks, Today, 09:29 PM
                0 responses
                3 views
                0 likes
                Last Post Belfortbucks  
                Started by zstheorist, Today, 07:52 PM
                0 responses
                7 views
                0 likes
                Last Post zstheorist  
                Started by pmachiraju, 11-01-2023, 04:46 AM
                8 responses
                150 views
                0 likes
                Last Post rehmans
                by rehmans
                 
                Started by mattbsea, Today, 05:44 PM
                0 responses
                6 views
                0 likes
                Last Post mattbsea  
                Started by RideMe, 04-07-2024, 04:54 PM
                6 responses
                33 views
                0 likes
                Last Post RideMe
                by RideMe
                 
                Working...
                X