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 Jimmyk, 01-26-2018, 05:19 AM
              6 responses
              835 views
              0 likes
              Last Post emuns
              by emuns
               
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,291 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              10 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              62 views
              0 likes
              Last Post halgo_boulder  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              9 views
              0 likes
              Last Post Option Whisperer  
              Working...
              X