Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Move PathTool in Charts with Script

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

    Move PathTool in Charts with Script

    I can find all user drawn pathes (PathTools) with following script and move the StartAnchor.Price:

    NinjaTrader.NinjaScript.DrawingTools.PathTool PT;
    foreach (Gui.NinjaScript.IChartObject thisObject in ChartPanel.ChartObjects)
    {
    if(thisObject is NinjaTrader.NinjaScript.DrawingTools.PathTool)
    {
    PT = thisObject as NinjaTrader.NinjaScript.DrawingTools.PathTool;
    PT.StartAnchor.Price = PT.StartAnchor.Price + rollingOffsetPoints;
    }
    }

    How can I move the whole path?
    Attached Files

    #2
    Hi Goldy, thanks for your post.

    Each Path object will have a ChartAnchors List<T> object that will hold all of the chart anchors. One would need to iterate through that array and modify each anchor.

    Code:
    NinjaTrader.NinjaScript.DrawingTools.PathTool PT;
                foreach (Gui.NinjaScript.IChartObject thisObject in ChartPanel.ChartObjects)
                {
                    if(thisObject is NinjaTrader.NinjaScript.DrawingTools.PathTool)
                    {
                        PT = thisObject as NinjaTrader.NinjaScript.DrawingTools.PathTool;
                        foreach(var anchor in PT.ChartAnchors)
                        {
                            //...
                        }
                    }
                }
    Please let me know if I can assist any further.
    Last edited by NinjaTrader_ChrisL; 03-31-2020, 10:21 AM.

    Comment


      #3
      Thank you Chris L.

      works fine but one line is missing:
      PT = thisObject as NinjaTrader.NinjaScript.DrawingTools.PathTool; Click image for larger version

Name:	Chis2020-03-30_162536.jpg
Views:	242
Size:	26.8 KB
ID:	1092259

      Comment


        #4
        Thanks Goldy, I updated my last post.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X