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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            42 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            20 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            29 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            46 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            38 views
            0 likes
            Last Post CarlTrading  
            Working...
            X