Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Rectangle Area && Opacity

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

    Draw.Rectangle Area && Opacity

    Hey NT,

    I believe I found a bug for y'all.

    On Draw.Rectangle it allows you to set the color for the area and opacity level, however it only draws the line and not the area at all. See code and picture.

    Code:
    Draw.Rectangle(this,"Line"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),1,(MAX(High,Period)[0]) - ((i+1)*TickSize*BoxSize),Brushes.Gray,Brushes.DimGray,5);
    This code should be drawing the area of the rectangle, but only draws the outline.

    Cheers,

    Sody
    Attached Files

    #2
    Draw Square

    Also, a suggestion!

    Draw.Square is awesome for Point and Figure, but there is no opacity parameter.. I would suggest adding one, us power users might really like it.

    Sody
    Attached Files

    Comment


      #3
      This may work,

      Create a separate Brush:
      Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
      brushBid.Opacity=0.3;

      This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.

      Comment


        #4
        Originally posted by NJA_MC View Post
        This may work,

        Create a separate Brush:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.Red);
        brushBid.Opacity=0.3;

        This works for me with some of the SharpDX stuff, don't see why the Brush wouldn't work for the lines as well.
        Getting closer maybe...

        Failed to call OnRender() for chart object 'Square': The calling thread cannot access this object because a different thread owns it'
        Code:
        Brush brushBid=new SolidColorBrush(System.Windows.Media.Colors.DimGray);
        			brushBid.Opacity=0.3;
        Code:
        Draw.Square(this,"tag"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),brushBid);
        Might need a new thread? Dispatch.BeginInvoke?

        Sody
        Last edited by SodyTexas; 05-12-2015, 12:52 PM.

        Comment


          #5
          I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

          Here is a FillRectangle example:
          RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
          Last edited by NJA_MC; 05-12-2015, 01:29 PM.

          Comment


            #6
            Originally posted by NJA_MC View Post
            I am not sure you can access the Draw functions in the OnRender... You will likely need to use the SharpDX functions.

            Here is a FillRectangle example:
            RenderTarget.FillRectangle(new RectangleF(chartControl.CanvasRight, chartScale.GetYByValue(key.Key) - (height / 2), (int)-(key.Value * barLengthScale), height), brushAsk.ToDxBrush(RenderTarget));
            Thanks, SharpDX functions worked..
            Attached Files

            Comment


              #7
              I'd recommend using SharpDX stuff directly rather than the draw methods for such tasks. For power users such as yourself, you can always create your own draw object, and in fact, implement your own signatures to be called from other indicators, etc...
              MatthewNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rjbtrade1, 11-30-2023, 04:38 PM
              2 responses
              72 views
              0 likes
              Last Post DavidHP
              by DavidHP
               
              Started by suroot, 04-10-2017, 02:18 AM
              5 responses
              3,021 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Stanfillirenfro, Today, 07:23 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              3 responses
              22 views
              0 likes
              Last Post cmtjoancolmenero  
              Started by olisav57, Yesterday, 07:39 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X