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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      649 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      576 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X