• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

changing timer location

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

    changing timer location

    Hi All,
    I have customized the attached indicator in the past, which print previous and current bar high/Low floating on chart. plus the duration for previous and current bar
    I would like to have the prior & current bar timer/duration printed at the top of the chart right hand corner, or lower left corner, instead of floating in the middle of the chart.
    I would appreciate you help in providing the script to change the location of the bar timer/duration if possible.

    Thank in advance
    Best Gus
    Attached Files

    #2
    Hello GussJ ,

    Thanks for your post.

    To fix the text in a place on the chart, you can use the Draw.TextFixed() method.

    Reference: https://ninjatrader.com/support/help..._textfixed.htm

    With two lines to show, I would suggest using one Draw.TextFixed() statements and then use the \n escape code in the string to show the second line on a new line.

    Example: Draw.TextFixed(this, "text", "CB: " + (Time[0]-Time[1]).ToString(@"hh\:mm\:ss")+"\nPB: "+(Time[1]-Time[2]).ToString(@"hh\:mm\:ss"), TextPosition.TopRight);
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Manged to get it to work, Thanks Paul,
      1.is it possible to have the option to change the font to different color and size/bold color,
      2.Also can I have it drawn on a different indicator panel instead of the main chart?
      3. is it possible to change the CB/PB High/Low top a fixed text as well ?
      Thanks
      Last edited by GussJ; 08-21-2019, 03:49 PM.

      Comment


        #4
        Hello GussJ ,

        Thanks for your reply.

        1. yes, you can use the Draw.TextFixed() overload that allows you to specify the (simplefont) font size, type and color, please see: https://ninjatrader.com/support/help..._textfixed.htm and https://ninjatrader.com/support/help...font_class.htm
        2. It would be easier if the text did not also draw on the price panel.
        3) Yes. same way as previously advise, through the use of \n to create a new line when a new line is needed.

        Notes: The Draw.TextFixed is limited in what you can do. If you want separate colors and separate fonts then for each change you would need a separate Draw.TextFixed statement which may cause difficulties trying to get the new line. I've attached an example of how you can use colors with Draw.TextFixed. Note that in this multi-line example the use of \t to "tab" over.

        DrawTextFixedColorExample.zip ​​​​​​​
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thank yo again Paul for your informative help much appreciated.
          1. how can I draw the script you sent me on a different panel? I tried to change the panel under indicator properties it didn't work. is it too complicated to do>
          2.what code I need to use in order to draw prior bar O/H/L/C as well as current bar I tried changing [0] to [-1] It didn't work.
          what I am trying to do is have to draw Prior bar and current bar high on the top right chart corner side by side, and prior and current bar lows on the lower right corner of chart
          my other option is to move them to a different panel right under each other similar to original script I sent previously
          any feedback is much appreciated

          Thanks again

          Comment


            #6
            Hello GussJ,

            Thanks for your reply.

            "how can I draw the script you sent me on a different panel?" In the OnStateChange() method, inside of State.SetDefaults, you would need to change the property DrawOnpricePanel from true to false. Recompile, and then apply the indicator to the panel of your choosing. DrawOnPricePanel refers to draw objects such as text, dots, lines, etc.

            "what code I need to use in order to draw prior bar O/H/L/C as well as current bar I tried changing [0] to [-1] It didn't work." the prior bar values would be referenced as [1] while the current bar values are [0].

            "what I am trying to do is have to draw Prior bar and current bar high on the top right chart corner side by side, and prior and current bar lows on the lower right corner of chart" You would need to use separate Draw.TextFixed statements and change the TextPosition from TopRight to BottomRight.


            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thanks again Paul,
              1. I am unable to use DrawOnpricePanel from true to false in my original script, it doesnt work for some reason. any feedback is appreciated.
              as for poiunt 3. when I try to add another 4 lines and change teh text to botttom right it doesn work
              I tried to add four more stings for prior bars OHLC, with 4 draw.test fixed associated with the prior bar I got an error.
              Any help is appreciated.
              As I only need Prior & current bars highs side by side on top right corner and prior * current bars low followed bar at bottom right corner.
              and be able to display them on different panels,and be able to change the colors & text size for each separately the text.,. just to keep it simple.

              Thank in advance
              your help is highly appreciated

              Best
              Gus
              Last edited by GussJ; 08-24-2019, 09:51 AM.

              Comment


                #8
                Hello Gus,

                Thanks for your reply.

                I suspect you are being overwhelmed by too many things interacting on the chart without understanding why. I would suggest creating a new indicator and starting simply with one Draw.TextFixed statement and manipulate it to achieve the ability to place it on other panels as well as other locations within the panel with the font and color desired. Then adding a second Draw.TextFixed() statement to work with the other one and again go through all of the options that you want. This is all a part of script creation (testing). Then add more until you finally reach where you want the indicator to be functionally. You can always reference back to the code i created and shared as an example of what can be done as well as how to do what you need.

                Please note that we do not provide code writing or debugging services. If you would like your indicator created for you an option is to hire a 3rd party programmer and we can provide references to them if you request.
                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Newtrader101, Today, 06:01 PM
                0 responses
                2 views
                0 likes
                Last Post Newtrader101  
                Started by Newtrader101, Today, 05:32 PM
                0 responses
                4 views
                0 likes
                Last Post Newtrader101  
                Started by ntbone, Yesterday, 11:53 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Johnny Santiago, Yesterday, 11:36 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by bouncetherubble, Yesterday, 07:07 PM
                2 responses
                9 views
                0 likes
                Last Post bouncetherubble  
                Working...
                X