Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MoveAnchorX

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

    MoveAnchorX

    I have created a Drawing Tool that draws a Rectangle that snaps to the High and Low of the selected bars within the Rectangle. Then I coded a polygon to draw the Volume Profile of the bars within the Rectangle. That works fine.

    Now I an attempting to move the vertical lines of the rectangle to the outside edge of the bar as opposed to NT default drawing them in the middle of the bar. I have uploaded an image for a visual.

    The latest attempt at this is:
    PHP Code:
    //MyAnchor.MoveAnchorX(lastPoint, newPoint, chartControl, chartScale);
    
    double barPixelWidth = chartControl.GetBarPaintWidth(chartControl.BarsArray[0]);    
        NinjaTrader.Code.Output.Process(string.Format("barPixelWidth {0}  ", barPixelWidth ), PrintTo.OutputTab1);    
    
    Point lastPoint = StartAnchor.GetPoint(chartControl, chartPanel, chartScale) ;
        NinjaTrader.Code.Output.Process(string.Format("lastPoint {0}  ", lastPoint ), PrintTo.OutputTab1);    
    
    double newX = lastPoint.X - barPixelWidth;
        NinjaTrader.Code.Output.Process(string.Format("newX {0}  ", newX ), PrintTo.OutputTab1);
    
    Point deltaPoint = new Point(newX, lastPoint.Y);
        NinjaTrader.Code.Output.Process(string.Format("lastPoint {0}   deltaPoint {1}", lastPoint, deltaPoint ), PrintTo.OutputTab1);
    
    StartAnchor.MoveAnchorX( lastPoint,  deltaPoint, chartControl, chartScale); 
    
    The OutputWindow shows;
    PHP Code:
    barPixelWidth 25  
    lastPoint 262.5,782.5  
    newX 237.5  
    lastPoint 262.5,782.5   deltaPoint 237.5,782.5 
    
    The StartAnchor DOES NOT move. What am I doing wrong? Suggestions?
    Thanks.
    Attached Files

    #2
    Hello TAJTrades,

    Thank you for reporting there may be an issue with the MoveAnchorX() method from anchors.

    I will test modifying this and if I am able to reproduce I will submit a report to our development.

    I appreciate your patience while I test.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Is there any update on this. I am still wondering if it is a "Me Issue" with the way I tried to code it or if it is something within NT?

      Comment


        #4
        Hello TAJTrades,

        We are still looking into this on our end.

        We will follow up with you when we have any details on this matter.

        Comment


          #5
          Hello TAJTrades,

          I am unable to reproduce the behavior.

          So I've copied and isolated the Line drawing tool in separate file to test this.

          In the OnMouseMove of the End anchor, I'm moving the StartAnchor with MoveAnchorX back and forth 50 pixels, and this appears to be working without any issue.

          Video of the test:
          World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


          Script tested attached.
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thanks Chelsea.

            Now I know where the issue is. Me. I will rework the code again to see if I can get the rectangles vertical line to move off the bar center

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            629 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            564 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X