Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Move overlapping rectangles to the left

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

    Move overlapping rectangles to the left

    Hi, i have created my own charttrader bars and would like to handle them the same way as in nt8. my problem now is that no trader bars should overlap. is there an example of how i could best solve this in another indicator.cs order similar?

    Maybe someone can give me a tip on how to solve the problem in the most elegant way ;-)
    my current example in OnRender() looks like this:

    PHP Code:
    int overlap = 0;
    bool intersects = false;
    int idx = 0;
    
    foreach (StopLoss sl in chartTraderSL.ToArray())
    {
    if (chartTraderSL[0].Index == sl.Index)
    goto draw;
    
    intersects = sl.OrderLabelRectText.Intersects(chartTraderSL[idx].OrderLabelRectText);
    idx++;
    
    if (intersects)
    overlap += 160;
    
    draw:
    DrawOrderLineSL(sl.Order, chartControl, chartScale, sl.Index, sl.OpenLoss, sl.TickValue, overlap);
    } 
    

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	198
Size:	29.8 KB
ID:	1140459
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    This would need to be achieved with custom logic. I'm not aware of any examples I can provide a link to.

    This thread will remain open for any community members that would like to assist.

    One suggestion might be to save the bar numbers of where objects are drawn, and if the next object is within a certain number of bars past a previous object to increment the price by the number of bars times the ticksize, to add a tick for every bar past..
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_ChelseaB Finding the overlapping rectangles is not a problem and is solved using the Intersects() function. My problem is the logic behind it ;-)
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      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
      137 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
      72 views
      0 likes
      Last Post PaulMohn  
      Working...
      X