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:	254
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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X