• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

White Vertical Lines using OnRender()

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

    White Vertical Lines using OnRender()

    Hi

    I'm using OnRender () to create a heat map style chart. Everything works great except for the fact that I'm getting repeating vertical thin white lines. When I use Draw.Rectangle( ) this does not occur. Clearly I'm not quite calculating the draw points for the x axis correctly. Could you please show or email me the code for Draw.Rectangle( ) so I might see how you calculate the x-xis draw points.

    Here's my use of:

    Draw.Rectangle(this,"Box"+CurrentBar+bin,true, 0, y,1,y + stp, Brushes.Transparent, brush, 75);

    Here my calculation of the x-axis within OnRender():

    int yCord = chartScale.GetYByValue(t.Price);
    int yCord2 = chartScale.GetYByValue(t.Price + TickSize);
    x= chartControl.GetXByBarIndex(ChartBars,t.Id);// - (int)(chartControl.BarWidth);


    RenderTarget.FillRectangle(new RectangleF((float)x, yCord2, (float) Math.Abs((float)x - (float)chartControl.GetXByBarIndex(ChartBars,t.Id -1)), (float)Math.Abs(yCord2 - yCord)),brush.ToDxBrush(RenderTarget));

    I see that it is a problem that others have had:

    http://ninjatrader.com/support/forum...ad.php?t=81757

    It's a great frustration and like I said does not occur using Draw.Rectangle( ). I think it would be a great service to the group to show how "statBarsAgo" and "endBarsAgo" are translated into x-axis plotting points.

    Thanks
    Last edited by boreland; 05-29-2016, 04:04 PM.

    #2
    I just wanted to say that I've fixed fixed this problem. The cause of regularly spaced thin vertical white lines is due to the cell width varying by 1 every n calculations. To fix this you have to first detect the white line and then adjust both the start and ends point of the next printing to remove the white line. Here is how I did it:

    //First Calculate the cell width of the first object
    if (idx == ChartBars.FromIndex) cellwidth = Math.Abs(0 - (int)chartControl.GetXByBarIndex(ChartBars,t.Id));

    //Calculated your y coordinates
    int yCord = chartScale.GetYByValue(t.Price);
    int yCord2 = chartScale.GetYByValue(t.Price + TickSize);

    //Calculated your x coordinate start point
    x= chartControl.GetXByBarIndex(ChartBars,t.Id)

    //Set object to be rendered behind the price bars
    SetZOrder(-1);

    //Render object
    RenderTarget.FillRectangle(new RectangleF((float)x - offset, yCord2, (cellwidth + offset), (float)Math.Abs(yCord2 - yCord)),brush.ToDxBrush(RenderTarget));

    //Calculated the print offset for the next object. This is the bit the removes the thin white line by shifting the next object to be displayed to the left.
    offset = Math.Abs((int)x - (int)chartControl.GetXByBarIndex(ChartBars,t.Id -1)) - cellwidth;

    Wallah, not more thin vertical white lines.
    Last edited by boreland; 05-30-2016, 10:22 PM.

    Comment


      #3
      Thank you for your update on this matter.
      Patrick H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by priceisking, Today, 12:51 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by chartish, Today, 10:33 AM
      3 responses
      15 views
      0 likes
      Last Post chartish  
      Started by casabella, Today, 11:51 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by Johnny, Today, 11:42 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jermaine  
      Started by habibalex, Today, 09:03 AM
      2 responses
      13 views
      0 likes
      Last Post sledge
      by sledge
       
      Working...
      X