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

Multi Time Frame referencing.....

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

    #16
    I think I have tried this at some point?

    Does it matter if I use "Opens" or "Closes"? By that I mean the line I am wanting to draw is the current OPEN. Will this work with:

    Code:
    if (BarsInProgress == 1)
    {
    	secondaryOpen.Set([COLOR="Red"]Opens[/COLOR][0][0]);
    }

    Comment


      #17
      I am using a 60 minute and a minute data series, and have tested on 5,10,15 minute. I believe when the hour data series updates, the close of the minute data series at that point is the open for the hour bars. I tried using various Opens and Closes. The only way I was able to make it work was to use Closes[0][0].
      Last edited by NinjaTrader_AdamP; 10-19-2011, 07:30 AM.
      Adam P.NinjaTrader Customer Service

      Comment


        #18
        Maybe I don't understand the problem, but why aren't you using BarsArray() function with mult-timeframes to update the chart only while BarsInProgress == 0... ?

        Comment


          #19
          Originally posted by borland View Post
          Maybe I don't understand the problem, but why aren't you using BarsArray() function with mult-timeframes to update the chart only while BarsInProgress == 0... ?
          I 'think' that's what I am doing? But that doesn't seem to work either.

          I am simply trying to plot the OPEN of a secondary data series onto a chart, and what I seem to come up with is something close to it. The only thing that seems to do exactly that is by using a negative bar index, but as Adam mentioned, that does lead to other undesirable effects.

          Comment


            #20
            Historical bars of a secondary data series must be shifted one bar to the right.

            I am using a 60 minute and a minute data series, and have tested on 5,10,15 minute. I believe when the hour data series updates, the close of the minute data series at that point is the open for the hour bars. I tried using various Opens and Closes. The only way I was able to make it work was to use Closes[0][0].
            This may explain some of the puzzling behaviour noted in this quote of _AdamP..

            In this example of how historical bars must be shifted one bar to the right, Values[0] is the output plot.

            Code:
            [FONT="Courier New"]
            if(BarsInProgress==1)LastSecondaryValue.Set(Closes[1][0]);
            
            If(Historical)Values[0].Set(LastSecondaryValue[1]); 
            else Values[0].Set(LastSecondaryValue[0]); [/FONT]
            Last edited by Ricam; 10-20-2011, 12:34 PM.

            Comment


              #21
              Thanks Ricam. Multiseries bars are referenced differently in real time compared to historical or CalculateOnBarClose = true. In historical, you are not able to access values from other series, when the bar time stamp is in advance of that series object. It's helpful to print timestamps from all series so you can see how they relate for each bar.

              if (BarsInProgress == 0)
              Print(CurrentBar + " Primary Series Time: " + Time[0] + " Secondary Series Time: " + Times[1][0]);

              This model is detailed here in the section How Bar Data is Referenced:


              A decent alternative to plots here may be drawing objects, because you can shift everything back using the bars ago property.
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by RookieTrader, Today, 07:41 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by kujista, Today, 05:44 AM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by elderan, Yesterday, 08:03 PM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by samish18, Yesterday, 08:57 AM
              8 responses
              25 views
              0 likes
              Last Post samish18  
              Started by DJ888, 04-16-2024, 06:09 PM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X