Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prevent a FillGeometry onrender object in NinjaScript from being selected on chart

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

    Prevent a FillGeometry onrender object in NinjaScript from being selected on chart

    Hello,
    I want this because it is makes me hard to select any user drawing tool, still when in properties is unchecked in "Allow the selection or drag/drop of chart series".

    Thank you in advance.

    I attach the code with the FillGeometry if it should be useful:

    Code:
    {
                                SharpDX.Direct2D1.PathGeometry     pathI;
                                SharpDX.Direct2D1.GeometrySink     sinkI;
                                pathI = new SharpDX.Direct2D1.PathGeometry(Core.Globals.D2DFac  tory);
                                using (pathI)
                                {
                                    count = -1;
                                    for (int idx = lastPlotIndex; idx >= firstPlotIndex; idx --)    
                                    {
                                        x = ChartControl.GetXByBarIndex(ChartBars, idx);
                                        if(Values[3].IsValidDataPointAt(idx-displacement))
                                        {    
                                            y = chartScale.GetYByValue(UpperBand1.GetValueAt(idx - displacement));
                                            returnBar = idx;    
                                        }    
                                        else
                                        {    
                                            returnBar = idx + 1;
                                            break;
                                        }    
                                        count = count + 1;
                                        cloudArray[count] = new Vector2(x,y);
                                    }
                                    if (count > 0)
                                    {    
                                        for (int idx = returnBar ; idx <= lastPlotIndex; idx ++)    
                                        {
                                            x = ChartControl.GetXByBarIndex(ChartBars, idx);
                                            y = chartScale.GetYByValue(LowerBand1.GetValueAt(idx - displacement));  
                                            count = count + 1;
                                            cloudArray[count] = new Vector2(x,y);
                                        }
                                    }    
                                    sinkI = pathI.Open();
                                    sinkI.BeginFigure(cloudArray[0], FigureBegin.Filled);
                                    for (int i = 1; i <= count; i++)
                                        sinkI.AddLine(cloudArray[i]);
                                    sinkI.EndFigure(FigureEnd.Closed);
                                    sinkI.Close();
                                     RenderTarget.FillGeometry(pathI, innerAreaBrushDX);
                                }
                                pathI.Dispose();
                                sinkI.Dispose();                    
                            }​​
    And a couple of short videos trying to make understand:
    When any drawing is out of FillGeometry, it can be easily selectable.

    This links will expire in 2 days


    This is ​when in properties is checked "Allow the selection or drag/drop of chart series".
    Last edited by joselube001; 07-05-2024, 02:35 PM.

    #2
    Hello joselube001,

    Put the code in a logic block checking for IsInHitTest to be false.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,
      thank you very much, it suits my needs.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      557 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X