Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing anchors within an indicator

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

    Accessing anchors within an indicator

    Hello,

    Is it possible to access and manipulate anchors from an indicator rather than a drawing tool?

    Using this in an indicator

    public override void OnMouseUp(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
    {

    // do stuff

    }

    produces no method to override errors.

    Alternatively, is it possible to access a dataseries from a drawing tool using OnBarUpdate or OnMarketData?

    Thanks for any help or samples that may be provided.

    rt

    #2
    Hello rt-trader,

    For your first question it is possible to access the anchors, you would just need an instance of the object:
    Code:
    NinjaTrader.NinjaScript.DrawingTools.Line line = Draw.Line(this, "test", 5, Close[5], 0, Close[0], Brushes.Red);
    line.StartAnchor.Price = High[0];
    Regarding getting the series, you could see GetAttachedToChartBars() if you are trying to get the Bars the object is attached to. The RegressionChannel tool uses this method to get the bars needed for its calculations.



    There is no concept of OnBarUpdate or OnMarketData in a DrawingObject, instead it is a rendered representation of the calculation it does. To apply logic like OnBarUpdate to a tool, you would likely need to pass the needed data in from the script it is called from. For example you could pass any variables needed such as a CurrentBar or even the MarketDataEventArgs object as an overload by creating your own Draw. method. Calling the same tag name would replace an object allowing you to provide updated information to be rendered.

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse

      Thanks very much for your reply and the information you have provided. I will experiment with your suggestions to see if I can develop the solution I am seeking.

      rt

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, Yesterday, 04:31 AM
      0 responses
      24 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      282 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      280 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      131 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X