Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Remaining Time to Bottom Left Corner

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

    Moving Remaining Time to Bottom Left Corner

    Hello,

    In regard to following indicator: https://ninjatraderecosystem.com/use...sound-alert-2/

    Which values would I have to change in order to have "remaining time digits" positioned at bottom right corner instead of top left corner?

    If it isn't possible to move the digits than is it possible to add background behind the digits so they would be clearly visible even if there is volume profile data positioned to the left or candles stacked at that area.

    Thank you
    Last edited by Ludwik; 06-03-2024, 04:20 AM.

    #2
    Hello Ludwik,

    This indicator uses X and Y values to place the drawing. You can replace the lines 156 and 157 which is the following code:

    Code:
    SharpDX.Vector2 upperTextPoint = new SharpDX.Vector2(ChartPanel.X + 10, ChartPanel.Y + (float)(simpleFont.Size * 1.5));
    SharpDX.DirectWrite.TextLayout textLayout1 = new SharpDX.DirectWrite.TextLayout(NinjaTrader.Core.Gl obals.DirectWriteFactory, timeLeft, textFormat1, ChartPanel.X + ChartPanel.W, textFormat1.FontSize);

    With the code below, this changes the X and Y positions for the text. The code below is ordered differently than the original so you can access the textLayout width, it would be easiest to copy the following two lines and completely replace lines 156 and 157. Then compile and reload the indicator.


    Code:
    SharpDX.DirectWrite.TextLayout textLayout1 = new SharpDX.DirectWrite.TextLayout(NinjaTrader.Core.Gl obals.DirectWriteFactory, timeLeft, textFormat1, 100, textFormat1.FontSize);
    SharpDX.Vector2 upperTextPoint = new SharpDX.Vector2((ChartPanel.X + ChartPanel.W) - textLayout1.MaxWidth, (ChartPanel.Y + ChartPanel.H) - textLayout1.MaxHeight - (float)(simpleFont.Size * 1.5));

    Comment


      #3
      Thank you for your help, I will do that

      Comment


        #4
        I replaced the code as instructed but getting following error messages:

        New Code:
        Code:
                    SharpDX.Vector2 upperTextPoint = new SharpDX.Vector2((ChartPanel.10 + ChartPanel.W) - textLayout1.MaxWidth, (ChartPanel.10 + ChartPanel.H) - textLayout1.MaxHeight - (float)(simpleFont.Size * 1.5));
        Error message:
        Click image for larger version

Name:	Przechwytywanie.png
Views:	64
Size:	12.5 KB
ID:	1306589


        Also ist it possible to have these fields in Indicator's Properties panel instead in the code? If so which code would I need to change?

        Comment


          #5
          Hello Ludwik,

          I have attached the script with the edit so you can compare what you copied. It looks like you may have just missed a few characters at the end of one of the lines.
          Attached Files

          Comment


            #6
            Hello Ludwik,

            Sorry about that, I forgot I had undone the changes to provide a comparison. I can see the problem, the forum sometimes adds random spaces in code blocks, there is a space in NinjaTrader.Core.Gl obals, that should be NinjaTrader.Core.Globals. Removing that space will correct the error.

            Comment


              #7
              I changed the code as requested. Removed space from NinjaTrader.Core.Gl obals but this time the clock won't appear at all. Could you please double check the code and let me know what exactly should I update in order for it to work?

              Comment


                #8
                Hello Ludwik,

                I see that working on my end, are you running the script in realtime?

                Click image for larger version  Name:	NinjaTrader_1BoJIpcO0B.png Views:	0 Size:	6.5 KB ID:	1306713

                Comment


                  #9
                  Please ignore the last comment it's working now. Thank you

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  576 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 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
                  553 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X