Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender method draws rectangles upsidedown

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

    OnRender method draws rectangles upsidedown

    I wish to use SharpDX to draw volume bars that overlap the main chart, while controlling its opacity dynamically. This is what I've attempted so far:
    Code:
    ...
               
                for (int idx = ChartBars.FromIndex; idx <= ChartBars.ToIndex; idx++)
                {
                    float x = chartControl.GetXByBarIndex(ChartBars, idx);
                    long v2 = ChartBars.Bars.GetVolume(idx);
                    float v2y = chartScale.GetYByValue(v2);
                    rect.X = x - barWidth * 0.5f + 0.5f;
                    rect.Y = 0;
                    rect.Width = barWidth - 1;
                    rect.Height = v2;
    
                    
                    RenderTarget.FillRectangle(rect, cbrush);
    				
                }cbrush.Dispose();
            }
    ...
    I don't know what I'm doing wrong, but the rectangle are drawn upside down; also the left-hand side y-axis volume units do not appear to be correct... What can I do to incorporate OnMarketData information on a tick by tick basis into my OnRender method call?
    Last edited by bkinvent; 01-22-2016, 01:30 AM.

    #2
    Hello,

    Thank you for the question.

    I checked the sample but was noticed there are a few missing variables here, I wanted to see if you could post a full example with your variables and how you are calculating the barWidth variable.

    I would like to first see what you are before trying to address your question.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    6 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by frslvr, 04-11-2024, 07:26 AM
    9 responses
    127 views
    1 like
    Last Post caryc123  
    Working...
    X