Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to initiate a series in a drawing tool?

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

    How to initiate a series in a drawing tool?

    Hi,
    I'm trying to add a series to a custom drawing tool

    like on state change
    :
    ..
    else if (State == State.Active)
    {
    // Series1 = new Series<double>(GetAttachedToChartBars().Bars, MaximumBarsLookBack.Infinite); // nope, didn't work
    // Series1 = new Series<double>(this, MaximumBarsLookBack.Infinite); // nope , didn't work
    Series1 = new Series<double>(xxx, MaximumBarsLookBack.Infinite); // what to use or totally different approach needed?

    }​
    ..

    so what to add to that xxx to get it attached to the bars data ?

    Somehow stuck now...







    #2
    Hello raffu,

    Thanks for your post.

    To clarify, are you trying to create a custom Series<double> variable and use that custom Series for your Draw method?

    You could create a Series<double> variable, assign a value to that variable in OnBarUpdate(), and then call your Draw method, such as Draw.TextFixed(), to draw the value of that custom Series variable on the chart.

    See the attached example script demonstrating this.

    Also, see the help guide documentation below for more information.

    Series<T>: https://ninjatrader.com/support/help...t8/seriest.htm
    Drawing: https://ninjatrader.com/support/help...t8/drawing.htm
    Draw.TextFixed: https://ninjatrader.com/support/help..._textfixed.htm

    Let me know if I may assist further.
    Attached Files
    <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
      Thanks but not for Indicator or Strategy to the new Drawing Tool !

      same what is achieved with:

      else if (State == State.DataLoaded) // this is not called from Drawing Tool ! ( but that is not a proble, State.Active could be used)
      {
      // Instantiate the custom Series<double>
      MyCustomSeries = new Series<double>(this); // if indicator or startegy used, this is simple // so this line????
      }
      ​
      but how to Drawing Tool


      Comment


        #4
        Hello raffu,

        Thanks for the clarification.

        Custom Series cannot be used in a custom DrawingTool. This is because draw objects do not manage historical data. DrawingTools use the attached object to find values based on anchors.

        ISeries<T> is an interface that is implemented by all NinjaScript classes that manage historical data as an ISeries<double> (Open, High, Low, Close, etc)

        See this help guide page about Series<T>: https://ninjatrader.com/support/help...l?iseriest.htm

        See this help guide page for more information about creating a custom DrawingTool: https://ninjatrader.com/support/help...wing_tools.htm

        Let me know if you have further questions.
        <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
          Thanks for confirming it, actually that was something what I thought...
          (it would have been too easy otherwise)

          Comment


            #6
            In order to create a series by explicitly proving index instead of the default, we have to provide a list of elements to the index parameter with the same number of elements as it is an array.


            # import pandas as pd
            import pandas as pd

            # import numpy as np
            import numpy as np

            # simple array
            data = np.array(['g', 'e', 'e', 'k', 's'])

            # providing an index
            ser = pd.Series(data, index=[10, 11, 12, 13, 14])
            print(ser)​

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X