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:	194
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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X