Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.OrderchartControlchartScalesl.Indexsl.OpenLosssl.TickValueoverlap);


    Click image for larger version

Name:	Screenshot_1.jpg
Views:	150
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 carnitron, Today, 08:42 PM
      0 responses
      5 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Today, 07:51 PM
      0 responses
      6 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,974 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      8 views
      0 likes
      Last Post rbeckmann05  
      Started by rhyminkevin, Today, 04:58 PM
      4 responses
      58 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Working...
      X