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 Karado58, 11-26-2012, 02:57 PM
      8 responses
      14,825 views
      0 likes
      Last Post Option Whisperer  
      Started by Option Whisperer, Today, 09:05 AM
      0 responses
      1 view
      0 likes
      Last Post Option Whisperer  
      Started by cre8able, Yesterday, 01:16 PM
      3 responses
      11 views
      0 likes
      Last Post cre8able  
      Started by Harry, 05-02-2018, 01:54 PM
      10 responses
      3,204 views
      0 likes
      Last Post tharton3  
      Started by ChartTourist, Today, 08:22 AM
      0 responses
      6 views
      0 likes
      Last Post ChartTourist  
      Working...
      X