Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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(chartControlchartPanelchartScale) ;
        
    NinjaTrader.Code.Output.Process(string.Format("lastPoint {0}  "lastPoint ), PrintTo.OutputTab1);    

    double newX lastPoint.barPixelWidth;
        
    NinjaTrader.Code.Output.Process(string.Format("newX {0}  "newX ), PrintTo.OutputTab1);

    Point deltaPoint = new Point(newXlastPoint.Y);
        
    NinjaTrader.Code.Output.Process(string.Format("lastPoint {0}   deltaPoint {1}"lastPointdeltaPoint ), PrintTo.OutputTab1);

    StartAnchor.MoveAnchorXlastPoint,  deltaPointchartControlchartScale); 
    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:
          Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


          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 CortexZenUSA, Today, 12:53 AM
            0 responses
            2 views
            0 likes
            Last Post CortexZenUSA  
            Started by CortexZenUSA, Today, 12:46 AM
            0 responses
            1 view
            0 likes
            Last Post CortexZenUSA  
            Started by usazencortex, Today, 12:43 AM
            0 responses
            5 views
            0 likes
            Last Post usazencortex  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            168 responses
            2,266 views
            0 likes
            Last Post sidlercom80  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X