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:	189
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 NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      89 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      152 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      80 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      53 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      63 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X