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

dataseries initilization

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

    dataseries initilization

    I am almost done programming this indicator but I don't know how to initialize these


    #region Properties
    [Browsable(false)]
    [XmlIgnore()]

    public DataSeries SMI //HOW DO I INITILIZE THESE
    {
    get { return Values[0]; }
    }

    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries SMIAvg //AND HOW DO i INITIALIZE THESE
    {
    get { return Values[1]; }


    private DataSeries relDiff;
    private Dataseries diff;
    private Dataseries avgRel;
    private DataSeries avgDiff;



    }
    Last edited by ballboy11; 07-18-2017, 05:38 AM.

    #2
    Hello ballboy11,

    Thank you for your post.

    Please provide further details on this matter. Are you attempting to make the DataSeries as user defined inputs? Are these plots you wish to expose to the UI for user editing?

    If possible please provide the full indicator code you are using. You can attach your indicator to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your Indicator > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

    I look forward to your response.

    Comment


      #3
      I am trying to create an smi indicatorfor myself

      Comment


        #4
        Hello ballboy11,

        Thank you for your response.

        To Initialize a DataSeries in NinjaTrader 7 you must do so within the Initialize() method of NinjaScript and set it to the calling NinjaScript object with 'this'. For example:
        Code:
        protected override void Initialize() 
        { 
            myDataSeries = new DataSeries(this); // "this" refers to the indicator, or strategy
                                                // itself. This syncs the DataSeries object
                                                // to historical data bars
        }
        This is taken from the following link on the DataSeries Class: http://ninjatrader.com/support/helpG...ries_class.htm

        Please let me know if you have any questions.

        Comment


          #5
          Hi,

          Is there a dataseries type which is can work without sync?
          Lets say i open 30 min ES chart with session template ETH.
          In one of my indicator i want to calculate and plot SMA(20) for both ETH and RTH.
          So i want to check time hour and minute if it's in regular trading hour i want to add close value to in a notSyncDataseries user defined variable (which is must not be work sync).
          and send this dataseries to SMA(notSyncDataseries, 20)

          Why need this?
          If there is no support that type dataseries in ninja.
          I have to store related close values on a arraylist.
          Then write custom method that calculating sma values (beucase Indicator.SMA method needs dataseries because of that i can not use it)
          ıf there is necessary revers arraylist before send to custom SMA method.

          Shortly i need a store values on a series but it don't have a value for each bar.

          Thanks,
          Aytac

          Comment


            #6
            Hello aytacasan, thanks for your post.

            The AddDataSeries method will allow you to add a data series with a different session template with this overload:

            AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)

            We also have an example here showing how to sync a data series to a second time frame:

            https://ninjatrader.com/support/help...series_obj.htm

            Please review this sample to see if it fits the requirement. If you needed an SMA on both RTH and ETH, you could also use a simple time filter to read the SMA at a certain time. We have an example of a time filter here:

            https://ninjatrader.com/support/help...to_limit_t.htm

            Please let me know if I can assist any further.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by BarzTrading, Today, 07:25 AM
            2 responses
            14 views
            1 like
            Last Post BarzTrading  
            Started by devatechnologies, 04-14-2024, 02:58 PM
            3 responses
            19 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by tkaboris, Today, 08:01 AM
            0 responses
            3 views
            0 likes
            Last Post tkaboris  
            Started by EB Worx, 04-04-2023, 02:34 AM
            7 responses
            162 views
            0 likes
            Last Post VFI26
            by VFI26
             
            Started by Mizzouman1, Today, 07:35 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X