Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing Rectangles

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

    Drawing Rectangles

    I have a strategy that generates about 4 signals in 1 week of backtesting in Strategy Analyzer.
    Each signal is supposed to draw a rectangle.
    But usually what happens it that only the last rectangle appears.
    (I think once, I saw all the rectangles)

    I am using unique tags.
    I'm using

    Code:
    Random random = new Random();
    int randomNumber = random.Next(0, 1000);
    Draw.Rectangle(this, "tag" + randomNumber, widthBars, High[widthBars] - TickSize, 0, Low[0] + TickSize, Brushes.Blue);
    How can I get all the rectangles to draw?​

    #2
    Figured it out - I was not using

    Random random = new Random();

    correctly

    Comment


      #3
      Hello reynoldsn,

      If you are attempting to use unique tag names, I recommend adding CurrentBar to the tag name.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Great idea - thank you. I think I did see this recently.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X