Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Text not working on a stack of panels

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

    Draw.Text not working on a stack of panels

    Hello,

    I made a simple script(attached) to show that Draw.Text does not display when the indicator is loaded on a multi-panel chart.
    A video showing this behavior can be downloaded from https://app.box.com/s/pgin5wchp7vy0ehxyyi2ydae0cq63ffv

    Any suggestions? Is there anything in the code that is not right? Thank you.

    NT 8.0.19.1 64-bit
    WIndows 7
    Attached Files
    Last edited by utilizator; 11-04-2019, 04:57 PM.

    #2
    Hello utilizator,

    Thank you for your note.

    It's right about the end of our support day today, however, I'll take a look at this first thing tomorrow and get back to you.

    Thanks for your patience, I look forward to assisting you further.

    Comment


      #3
      Hello utilizator,

      Thank you for your reply.

      I think you may be running into an issue with using (CurrentBar - redLine.StartAnchor.SlotIndex) when the text is updated - with multiple data series there can be differing numbers of bar slots and that can throw the display off. I think you'll find if you scroll forward from the current price a bit that you'll see the text somewhere offscreen. Try using (CurrentBar - redLine.StartAnchor.DrawnOnBar + 20) instead - that should draw the text where you expected in relation to the current bar regardless of available slots.



      Please let us know if we may be of further assistance to you.

      Comment


        #4
        Thank you Kate, your solution worked.

        Comment


          #5
          Beside hardcoding the '20' value in

          // update the text along with the line
          T2Text = Draw.Text(this,T2Text.Tag,T2Text.DisplayText,
          // (int)(CurrentBar - redLine.StartAnchor.SlotIndex), // barsAgo

          (int)((CurrentBar - redLine.StartAnchor.DrawnOnBar)+20), // here, CurrentBar == redLine.StartAnchor.DrawnOnBar
          redLine.StartAnchor.Price); // price

          is there a way to get it from redLine ?

          redLine=Draw.Line(this, redLine.Tag,
          20,Close[0]/* start */,
          5, Close[0], /* end */
          redLine.Stroke.Brush);

          Comment


            #6
            Hello utilizator,

            Thank you for your reply.

            Since it's the same value you're using in both, why not just use a variable for both? Set it to myVariable = 20 and then use the variable in both places?

            Please let us know if we may be of further assistance to you.

            Comment


              #7
              Thank you Kate. Of course, but this is a simplified example, and I would like to avoid using new additional storage variables. I understand there is not a straightforward way to get '20' from redLine's anchor, correct?

              Comment


                #8
                Hello utilizator,

                Thank you for your reply.

                You could use redLine.startBarsAgo in lieu of using a variable. However, a variable may make it easier to remember that those two spots are using the same value.

                Please let us know if we may be of further assistance to you.

                Comment


                  #9
                  Thank you ! Actually it was absoluteBar = (<ChartAnchor>.DrawnOnBar - <ChartAnchor>.BarsAgo )

                  Code:
                   [COLOR=#006400]// update the line with the incoming price[/COLOR]
                              redLine=Draw.Line(this, redLine.Tag,
                                                  20,Close[0][COLOR=#006400]/* start */,[/COLOR]
                                                  5, Close[0], [COLOR=#006400]/* end */[/COLOR]
                                                  redLine.Stroke.Brush);
                  
                  [COLOR=#006400]// update the text along with the line[/COLOR] 
                              T2Text = Draw.Text(this,T2Text.Tag,T2Text.DisplayText,
                  [COLOR=#006400]//                (int)(CurrentBar - redLine.StartAnchor[/COLOR].[COLOR=#FF0000]SlotIndex[/COLOR][COLOR=#006400]), // barsAgo[/COLOR]
                                  CurrentBar - (redLine.StartAnchor.[COLOR=#FF0000]DrawnOnBar[/COLOR]-redLine.StartAnchor.[COLOR=#FF0000]BarsAgo[/COLOR]),  
                  
                                  redLine.StartAnchor.Price);
                  Last edited by utilizator; 11-08-2019, 04:31 AM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  574 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  332 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