Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change Dash Style

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

    Change Dash Style

    Hello, how can I change the Dash Style (Outline) when I draw a rectangle from my own indicator? I have checked all the parameters for Draw.Rectangle and I can't find a way to get it.

    Thanks and regards.

    #2
    Hello soyjesus,

    Thanks for your post.

    You can change this a couple of ways. One of the method overloads includes the ability to apply a named template. To create a template you can manually draw a rectangle (its size/shape does not matter) then change its colors and lines as you want them to be and save the template with a specific name. When you use the overload with the specific template name, it will draw the rectangle according to how you have specified in the code and will use the characteristics of the template for the line type and colors. Please review, "Understanding Drawing Object templates" for further details: https://ninjatrader.com/support/help..._tools__ob.htm

    Alternately, In the code, you can use the Rectangle interface to change the stroke of the outline.
    References:



    From the above references, Here is an example:

    Rectangle myRec = Draw.Rectangle(this, "tag1", 10, Low[10] - TickSize, 5, High[5] + TickSize, Brushes.Blue);
    myRec.OutlineStroke = new Stroke(Brushes.Blue, DashStyleHelper.Dash, 3f);

    Click image for larger version

Name:	soyj-1.PNG
Views:	325
Size:	27.5 KB
ID:	1045574

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    38 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X