Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Transform series data

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

    Transform series data

    hi,
    i 've this code in nt7 :
    (in chart i load 100 bar)
    Code:
          protected override void OnBarUpdate()
            {
    
               if (CurrentBar==90) 
    			Print(MIN(Low,1)[-1]);
            }

    (there isn't error....if i'm in real time..i get 0)


    if i run this...i don't get error because in historic i can analyse series [-1]...
    if i'm in real time....i get MIN(Low,1)[-1] =0 ..


    if i've the same code in nt8
    Code:
    	protected override void OnBarUpdate()
    		{
               if (CurrentBar==90) 
    			Print(Min(Low,1)[-1]);
    		}
    i get error in nt8



    i hope do you have understand what i mean with this post..

    i want to use dataseries in nt8 as in nt7

    i want use [-1] in nt8

    how can i change dataseries in nt8 to do it? ..(override? ..or other)
    Last edited by turbofib; 10-31-2016, 06:26 AM.

    #2
    Hello Turbofib,

    Thank you for your note.

    In NinjaTrader 8, you should be able to reference negative index values in, State.Historical.

    So for example,

    if (State == State.Historical)
    {
    if (CurrentBar==90)
    {
    Print(MIN(Low,1)[-1]);
    }
    }

    See State.Historical section of our Helpguide:


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Can i use it (State == State.Historical) in OnBarUpdate ?

      Comment


        #4
        Excuse me...i try it :


        protected override void OnBarUpdate()
        {

        double tmp = 0;

        if (State == State.Historical)
        tmp = Min(Low, 1)[-1];

        if (CurrentBar==90)
        Print(tmp);
        }
        but it give me error



        ....

        i try it..but it give me same error

        if (State == State.Historical)
        {
        if (CurrentBar==90)
        {
        Print(MIN(Low,1)[-1]);
        }
        }
        Last edited by turbofib; 10-31-2016, 12:46 PM.

        Comment


          #5
          Hello Turbofib,

          While any bar data series will have the full collection of historical data, this is not the case for indicators that must plot in OnBarUpdate, what this means is that you can call Close[-1], but you could not call SMA(14)[-1]. It would not be advised to peak into the future as this will not work in real time, can I clarify what you are trying to achieve?

          I look forward to your reply.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            i try it :


            if (CurrentBar == 90)
            // Print(tmp);
            Print(Close[-1]);

            but it give me the same error

            Comment


              #7
              Hello Turbofib,

              I just learned that the behavior in NinjaTrader 8 has changed from NinjaTrader 7 which would allow you to use a negative index value in a bar series.

              Your initial inquiry was correct and this is no longer possible in NinjaTrader 8.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Tim-c, Today, 02:10 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Taddypole, Today, 02:47 PM
              0 responses
              2 views
              0 likes
              Last Post Taddypole  
              Started by chbruno, 04-24-2024, 04:10 PM
              4 responses
              50 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              10 responses
              401 views
              1 like
              Last Post beobast
              by beobast
               
              Started by lorem, Yesterday, 09:18 AM
              5 responses
              25 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X