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

How to Add MultiTime Frame IDataSeries

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

    How to Add MultiTime Frame IDataSeries

    For example : I want get a IDataSeries to store the (High-Low) of day period
    this is the code: load it in minitue 1 chart
    #region Variables
    private DataSeries myDS;
    #endregion
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Add(PeriodType.Day,1);
    myDS=new DataSeries(this);
    }
    protected override void OnBarUpdate()
    {
    if(BarsInProgress==1)
    {
    myDS.Set(Highs[1][0] - Lows[1][0]);
    Print(Time[0].ToString()+" "+CurrentBar+" A New Day"+myDS[0].ToString("0.00")+" "+myDS[1].ToString("0.00")+" "+myDS[2].ToString("0.00"));
    }
    }
    You will find the DataSeries is Only Get the Last One,previous is Wrong....
    The DataSeries Can't Be Use .

    #2
    dsin51, can you please give this changed snippet a run on your end?

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;

    if(BarsInProgress == 0)
    {
    myDS.Set(Highs[1][0] - Lows[1][0]);
    }
    BertrandNinjaTrader Customer Service

    Comment


      #3
      protected override void OnBarUpdate()
      {
      if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;

      if(BarsInProgress==0)
      {

      myDS.Set(Highs[1][0] - Lows[1][0]);
      Print(Time[0].ToString()+" "+CurrentBar+" A New Day"+myDS[0].ToString("0.00")+" "+myDS[1].ToString("0.00")+" "+myDS[2].ToString("0.00"));
      }
      }

      The Re**** is
      2011-9-13 15:46:00 68625 A New Day1.21 1.21 1.21
      2011-9-13 15:47:00 68626 A New Day1.21 1.21 1.21
      2011-9-13 15:48:00 68627 A New Day1.21 1.21 1.21
      2011-9-13 15:49:00 68628 A New Day1.21 1.21 1.21
      2011-9-13 15:50:00 68629 A New Day1.21 1.21 1.21
      2011-9-13 15:51:00 68630 A New Day1.21 1.21 1.21
      2011-9-13 15:52:00 68631 A New Day1.21 1.21 1.21
      2011-9-13 15:53:00 68632 A New Day1.21 1.21 1.21
      2011-9-13 15:54:00 68633 A New Day1.21 1.21 1.21
      2011-9-13 15:55:00 68634 A New Day1.21 1.21 1.21
      2011-9-13 15:56:00 68635 A New Day1.21 1.21 1.21
      2011-9-13 15:57:00 68636 A New Day1.21 1.21 1.21
      2011-9-13 15:58:00 68637 A New Day1.21 1.21 1.21
      2011-9-13 15:59:00 68638 A New Day1.21 1.21 1.21
      2011-9-13 16:00:00 68639 A New Day1.24 1.21 1.21
      2011-9-14 9:31:00 68640 A New Day1.24 1.24 1.21
      2011-9-14 9:32:00 68641 A New Day1.24 1.24 1.24
      2011-9-14 9:33:00 68642 A New Day1.24 1.24 1.24
      2011-9-14 9:34:00 68643 A New Day1.24 1.24 1.24
      2011-9-14 9:35:00 68644 A New Day1.24 1.24 1.24
      2011-9-14 9:36:00 68645 A New Day1.24 1.24 1.24
      2011-9-14 9:37:00 68646 A New Day1.24 1.24 1.24
      2011-9-14 9:38:00 68647 A New Day1.24 1.24 1.24
      2011-9-14 9:39:00 68648 A New Day1.24 1.24 1.24
      2011-9-14 9:40:00 68649 A New Day1.24 1.24 1.24
      2011-9-14 9:41:00 68650 A New Day1.24 1.24 1.24
      2011-9-14 9:42:00 68651 A New Day1.24 1.24 1.24
      2011-9-14 9:43:00 68652 A New Day1.24 1.24 1.24
      2011-9-14 9:44:00 68653 A New Day1.24 1.24 1.24
      2011-9-14 9:45:00 68654 A New Day1.24 1.24 1.24

      SEE!?
      changed when day was changed. and the myDS was in filled by mintue1 data series , I wanted it filled by Day1 data series , IF it run in the Day period chart, it works right
      2011-9-1 16:00:00 168 A New Day1.53 0.82 0.97
      2011-9-2 16:00:00 169 A New Day0.74 1.53 0.82
      2011-9-6 16:00:00 170 A New Day0.72 0.74 1.53
      2011-9-7 16:00:00 171 A New Day1.11 0.72 0.74
      2011-9-8 16:00:00 172 A New Day1.47 1.11 0.72
      2011-9-9 16:00:00 173 A New Day1.27 1.47 1.11
      2011-9-12 16:00:00 174 A New Day1.21 1.27 1.47
      2011-9-13 16:00:00 175 A New Day1.24 1.21 1.27
      2011-9-14 16:00:00 176 A New Day1.33 1.24 1.21
      2011-9-15 16:00:00 177 A New Day0.69 1.33 1.24
      2011-9-16 16:00:00 178 A New Day1.25 0.69 1.33

      Comment


        #4
        Correct, in BIP0 the series would be filled by 1 minute data values, if you just want to see a print happen once per day with your daily range, then consider doing for example on the first bar of the session -



        When you're adding a daily series programmatically as in your first script you would unfortunately run into the limitation seen.

        To also add an important concept: in NT everything is event based based, meaning : the bar is not considered closed until the opening tick of the next bar is seen.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          just like this
          2011-8-11 9:31:00 59670 A New Day1.87 0.00 1.08
          2011-8-12 9:31:00 60060 A New Day2.70 0.00 0.99
          2011-8-15 9:31:00 60450 A New Day2.10 0.00 0.59
          2011-8-16 9:31:00 60840 A New Day0.75 0.00 0.91
          2011-8-17 9:31:00 61230 A New Day0.80 0.00 1.14
          2011-8-18 9:31:00 61620 A New Day0.94 0.00 1.12
          2011-8-19 9:31:00 62010 A New Day0.97 0.00 1.21
          2011-8-22 9:31:00 62400 A New Day1.20 0.00 1.43
          2011-8-23 9:31:00 62790 A New Day1.83 0.00 1.01
          2011-8-24 9:31:00 63180 A New Day2.49 0.00 0.36
          2011-8-25 9:31:00 63570 A New Day1.33 0.00 0.92
          2011-8-26 9:31:00 63960 A New Day3.15 0.00 0.75
          2011-8-29 9:31:00 64350 A New Day1.66 0.00 0.73
          2011-8-30 9:31:00 64740 A New Day1.17 0.00 0.55
          2011-8-31 9:31:00 65130 A New Day0.97 0.00 0.51
          2011-9-1 9:31:00 65520 A New Day0.82 0.00 0.63
          2011-9-2 9:31:00 65910 A New Day1.53 0.00 0.39
          2011-9-6 9:31:00 66300 A New Day0.74 0.00 0.70
          2011-9-7 9:31:00 66690 A New Day0.72 0.00 0.47
          2011-9-8 9:31:00 67080 A New Day1.11 0.00 0.72
          2011-9-9 9:31:00 67470 A New Day1.47 0.00 1.10
          2011-9-12 9:31:00 67860 A New Day1.27 0.00 0.84
          2011-9-13 9:31:00 68250 A New Day1.21 0.00 1.03
          2011-9-14 9:31:00 68640 A New Day1.24 0.00 0.52
          2011-9-15 9:31:00 69030 A New Day1.33 0.00 0.86
          2011-9-16 9:31:00 69420 A New Day0.69 0.00 1.49
          2011-9-19 9:31:00 69810 A New Day1.25 0.00 0.84

          obviously this is wrong re****
          the follow is right when it use in day chart ,but it must works in mintue chart
          2011-8-10 16:00:00 152 A New Day1.87 2.60 4.03
          2011-8-11 16:00:00 153 A New Day2.70 1.87 2.60
          2011-8-12 16:00:00 154 A New Day2.10 2.70 1.87
          2011-8-15 16:00:00 155 A New Day0.75 2.10 2.70
          2011-8-16 16:00:00 156 A New Day0.80 0.75 2.10
          2011-8-17 16:00:00 157 A New Day0.94 0.80 0.75
          2011-8-18 16:00:00 158 A New Day0.97 0.94 0.80
          2011-8-19 16:00:00 159 A New Day1.20 0.97 0.94
          2011-8-22 16:00:00 160 A New Day1.83 1.20 0.97
          2011-8-23 16:00:00 161 A New Day2.49 1.83 1.20
          2011-8-24 16:00:00 162 A New Day1.33 2.49 1.83
          2011-8-25 16:00:00 163 A New Day3.15 1.33 2.49
          2011-8-26 16:00:00 164 A New Day1.66 3.15 1.33
          2011-8-29 16:00:00 165 A New Day1.17 1.66 3.15
          2011-8-30 16:00:00 166 A New Day0.97 1.17 1.66
          2011-8-31 16:00:00 167 A New Day0.82 0.97 1.17
          2011-9-1 16:00:00 168 A New Day1.53 0.82 0.97
          2011-9-2 16:00:00 169 A New Day0.74 1.53 0.82
          2011-9-6 16:00:00 170 A New Day0.72 0.74 1.53
          2011-9-7 16:00:00 171 A New Day1.11 0.72 0.74
          2011-9-8 16:00:00 172 A New Day1.47 1.11 0.72
          2011-9-9 16:00:00 173 A New Day1.27 1.47 1.11
          2011-9-12 16:00:00 174 A New Day1.21 1.27 1.47
          2011-9-13 16:00:00 175 A New Day1.24 1.21 1.27
          2011-9-14 16:00:00 176 A New Day1.33 1.24 1.21
          2011-9-15 16:00:00 177 A New Day0.69 1.33 1.24
          2011-9-16 16:00:00 178 A New Day1.25 0.69 1.33
          the dataseries based on mintue not day default
          how to let dataseies based on other time frame not default .

          Comment


            #6
            The first result looks ok to me, this is the first point where you're sure to have received the closing tick for your daily bars referenced - you could though try calculating for example the needed value at 1614, one minute before the official US EST closing time.

            If you would like to sync the custom dataseries to the second timeframe, please check into this reference sample here : http://www.ninjatrader.com/support/f...ead.php?t=3572
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by helpwanted, Today, 03:06 AM
            1 response
            11 views
            0 likes
            Last Post sarafuenonly123  
            Started by Brevo, Today, 01:45 AM
            0 responses
            9 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            5 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            242 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            387 views
            1 like
            Last Post Gavini
            by Gavini
             
            Working...
            X