Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with draw.text

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

    #46
    isAutoScale will automatically adjust the scale of the chart so that the object will be visible along with the ChartBars.

    The Anchor time is time stamp of the bar your code is drawing the bar on. So if you want to draw it on another bar, you would need to call Draw.Text on a different bar. Although 1800 is very unexpected, there could be something else going on.

    You could also use the overload that allows you to specify DateTime instead of barsAgo.

    Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, DateTime time, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)


    Basically if you are able to see the draw object in the list of drawing objects and when you check 'isAutoScale', there isn't anything wrong going in the code - the script is successfully creating the object where you are specifying the object to be. If you wanted it to be closer to the bars then you would just need to change the y parameter. Because you are passing 10 and 20 this is going to be very far away from the bars, you're saying you want to the object to be drawn at y = 10 or y = 20 which is the price scale. There are likely no instruments are going to have prices that low.

    Comment


      #47
      thanks for explanation.
      BTW, do you know what value do I set for the following properties? are they going to impact the drawing object?

      IsOverlay = false;
      DrawOnPricePanel = true;

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      42 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      157 views
      2 likes
      Last Post CaptainJack  
      Working...
      X