Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing Addplot in OR e.g

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

    Drawing Addplot in OR e.g

    Hello,

    I know its not possible to use Addplot in OR.
    Is there somewhere an example how to draw a moving average in OR class i could reproduce?

    TY

    #2
    Hello frankduc,

    Thanks for your post.

    Please clarify the following. Are you referring to OnRender() when you mention 'OR'?

    As noted in the Tips section of the OnRender() help guide page, you can combine plotting and custom rendering if you call base.OnRender() since plotting is handled in the base class. See the second example in the OnRender() help guide page which demonstrates calling the base.OnRender() method to ensure Plots are rendered along with custom render logic

    If you want to draw a similar plotline, you could use PathGeometry to make a figure that traces the data points in a series, and DrawGeometry to draw the line outlining that figure (which is just a line).

    See the help guide documentation below for more information.

    OnRender(): https://ninjatrader.com/support/help...8/onrender.htm
    PathGeometry(): https://ninjatrader.com/support/help...thgeometry.htm
    DrawGeometry(): https://ninjatrader.com/support/help...awgeometry.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hello,

      I am not sure how to put this:

      Code:
      foreach (var item in listm)
      {
      
      base.OnRender(chartControl, chartScale);
      Value[0] = item;
      }
      The prices are in the list.

      AddPlot(Brushes.Yellow, "NEWSDBA"); is in protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {

      TY

      Comment


        #4
        Hello frankduc,

        Thanks for your note.

        A value would need to be assigned to the plot in OnBarUpdate(), then you would call base.OnRender() in OnRender() to ensure Plots are rendered along with custom render logic.

        See the Ichimoku Cloud indicator from the NinjaTrader Ecosystem User App Share linked below for an example of using base.OnRender().
        https://ninjatraderecosystem.com/use...indicator-nt8/

        Let us know if we may further assist.

        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hello Brandon,

          You said:
          A value would need to be assigned to the plot in OnBarUpdate(),
          To do that i need to declare my list outside the class
          Code:
          private List<double> myList = new List<double>();
          Than extract the value from the list. But to do that is it possible to create a new class? Will Addplot method work in another class or must i stay in OnBarUpdate?
          Like

          Code:
          public class MyIndicator
          {
          private List<double> myList = new List<double>();
          public List<double> GetList()
           return myList;
          }
          }
          Code:
          public class CallingClass
          {
          MyClass myClass = new MyClass();
          public void GetList()
          {
          List<double> calledList = myClass.GetList();
           }
          }
          TY

          Comment


            #6
            Hello frankduc,

            Thanks for your note.

            Unfortunately, in the support department at NinjaTrader it is against our policy to provide C# programming education services in our support. This is so that we can maintain a high level of service for all of our clients as well as our partners. That said, you would need to use external C# tutorials to learn about how to use lists as well as where in a class the variable would go depending on what the use case is.

            Here is a publicly available link about Lists: https://docs.microsoft.com/en-us/dot...generic.list-1

            Please refer to the sample in this help guide link which uses a list and a custom class: https://ninjatrader.com/support/help...vel_ii_dat.htm

            In regards to your inquiry about the plot, please simplify what the problem you are encountering is. Otherwise, see the Bollinger bands indicator code for an example of plotting and using AddPlot(). To view the code of the Bollinger band indicator, open a New > NinjaScript Editor window, open the Indicators folder, and select the Bollinger file.

            Let us know if we may assist further.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            597 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            343 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            556 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            555 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X