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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        45 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        21 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        31 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        50 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X