Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing : Fill between 2 vectors

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

    Drawing : Fill between 2 vectors

    Hi Ninja's;

    I'm trying to fill a zone between two vectors with the following function on a custom drawing tool, but, it'doesn't show at all, may you tell me if the function is correct please?
    HTML Code:
    private void FillBands(Vector2 startVector, Vector2 endVector)
      {
          RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive;
    
    
          SharpDX.Direct2D1.PathGeometry polyGeo = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFactory);
          SharpDX.Direct2D1.GeometrySink geoSink = polyGeo.Open();
      
        
          geoSink.BeginFigure(startVector, SharpDX.Direct2D1.FigureBegin.Filled);
          geoSink.SetFillMode(SharpDX.Direct2D1.FillMode.Winding);
    
          geoSink.AddLine(endVector);
          geoSink.EndFigure(SharpDX.Direct2D1.FigureEnd.Open);
          geoSink.Close();
     
          RenderTarget.FillGeometry(polyGeo, areaDeviceBrush.BrushDX);
    
          polyGeo.Dispose();
      }​

    #2
    Hello TradeForge,

    Thanks for your post.

    How exactly are the Vector2 objects being defined in the script?

    How are you defining the brush used in the geometry? Are you calling something like the code below?

    SharpDX.Direct2D1.SolidColorBrush customDXBrush = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, SharpDX.Color.DodgerBlue);

    When calling geoSink.EndFigure() I see you are calling FigureEnd.Open. If you change FigureEnd.Open to FigureEnd.Closed, does the behavior persist?

    On the help guide documentation below you could review "SharpDX Lines and Shapes" > "Geometry" sample code for an example of using PathGeometry, GeometrySink, and FillGeometry() to see how these are used:



    You could also view the Ichimoku Cloud indicator from the NinjaTrader Ecosystem User App Share which also demonstrates using SharpDX to fill an area between points.

    Ichimoku Cloud: https://ninjatraderecosystem.com/use...indicator-nt8/


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Brandon, thank you for your reply, the exemple provided with the indicator works perfectly after a few adaptations

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      46 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X