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

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.
    JesseNinjaTrader Customer Service

    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 Barry Milan, Yesterday, 10:35 PM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Started by DJ888, 04-16-2024, 06:09 PM
      4 responses
      13 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by terofs, Today, 04:18 PM
      0 responses
      11 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by nandhumca, Today, 03:41 PM
      0 responses
      8 views
      0 likes
      Last Post nandhumca  
      Working...
      X