• 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:	41
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 soulfx, Today, 03:57 AM
        0 responses
        3 views
        0 likes
        Last Post soulfx
        by soulfx
         
        Started by digibob, Today, 03:45 AM
        0 responses
        5 views
        0 likes
        Last Post digibob
        by digibob
         
        Started by Matts7, Today, 12:56 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by barrybrice, Yesterday, 08:51 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by hayleeabb, Today, 12:30 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Working...
        X