• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    Chris L.NinjaTrader Customer Service

    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:	38
Size:	26.8 KB
ID:	1092259

      Comment


        #4
        Thanks Goldy, I updated my last post.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RuthB, Today, 09:41 PM
        0 responses
        1 view
        0 likes
        Last Post RuthB
        by RuthB
         
        Started by dtl-saw, Today, 08:50 PM
        0 responses
        2 views
        0 likes
        Last Post dtl-saw
        by dtl-saw
         
        Started by waterman, Today, 07:02 PM
        0 responses
        8 views
        0 likes
        Last Post waterman  
        Started by authenticx, Today, 03:51 PM
        0 responses
        17 views
        0 likes
        Last Post authenticx  
        Started by PN720, Today, 12:54 PM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X