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

PriorDayOHLC and prices

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

    PriorDayOHLC and prices

    Hello,

    I'd like to get the value, for example, of the NQ or ES at 4:00pm EST yesterday, and compare it to the value at the open 9:30am EST this morning. I know using the PriorDayOHLC will return values from different times than the ones I'd like.

    I suppose I could compare the open[0] to close[900] or how many ever bars ago, but I'm sure that's an inefficient way of doing it. Is there a simpler way of doing it? Thank you for your help!

    #2
    Hello VV Cephei,

    Thank you for your note.

    Since, 4:00 PM is the first bar of the session you could use -
    Code:
    if(Bars.FirstBarOfSession)
    double openPrice = Close[0];
    You can than take openPrice and compare it to Open[0] at 9:30 AM

    http://www.ninjatrader.com/support/h...rofsession.htm

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi there, thanks for your help.

      I'm still having some problems, so I attached sample so you could see if I'm on the right track:

      if (Bars.FirstBarOfSession == true)
      {
      double PrevDayClose = Close[0];
      }

      // condition
      if (Open[0] - PrevDayClose > 5 && ToTime(Time[0]) == ToTime(9, 30, 0))
      {
      EnterLong(DefaultQuantity, "");
      }

      I"m getting the message that 'close' and 'prevdayclose' do not exist in this context.

      Comment


        #4
        You can apply a session template to your chart which isolates the regular session within the full session. This allows you to catch the regular open (open of the first bar of the session) and the regular close (close of the last bar of the session). It is better to use the settlement price instead of the regular close. The settelement price can only be taken from daily data, if supplied by your data provider.

        The chart below catches the settlement price from daily Kinetick data and compares it to the open of today's session. The difference is displayed as gap. The gap remains on the chart until it is closed durgin the regular session.

        Today's new gap was insignificant, as today's regular open (4324.50) was only 1 tick below yesterday's settlement price (4324.75). However, there were two open gaps on the chart from February 12 and March 12. Both were closed during the first 3 hours of the regular session.
        Attached Files

        Comment


          #5
          Thanks Harry for the idea as well as posting that chart.

          I was wondering if someone could help or clear something up for me with the suggestion that Harry made.

          I tried to create a template by going to tools>session manager then I try to change it from the 24/7 default setting. I put it to US Equities RTH. But what's strange is that when I go back into Tools>Session Manager I see that 24/7 default is selected. And it doesn't seem to matter if I change it back or not, each time I go back to session manager it appears that my selection doesn't stay for some reason. I even made my own template and saved it under a name, but when I select it the same thing happens. Once I come back in, the default 24/7 appears to be selected.

          Comment


            #6
            Originally posted by VV Cephei View Post
            Thanks Harry for the idea as well as posting that chart.

            I was wondering if someone could help or clear something up for me with the suggestion that Harry made.

            I tried to create a template by going to tools>session manager then I try to change it from the 24/7 default setting. I put it to US Equities RTH. But what's strange is that when I go back into Tools>Session Manager I see that 24/7 default is selected. And it doesn't seem to matter if I change it back or not, each time I go back to session manager it appears that my selection doesn't stay for some reason. I even made my own template and saved it under a name, but when I select it the same thing happens. Once I come back in, the default 24/7 appears to be selected.
            You do not select session templates within the session manager. The session manager is only used to build and store session templates.

            You select the session template when you open a new chart or for existing charts under DataSeries settings. Please be aware that any chart template that you select overrides the session template settings.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            2 views
            0 likes
            Last Post Perr0Grande  
            Started by elderan, Today, 08:03 PM
            0 responses
            5 views
            0 likes
            Last Post elderan
            by elderan
             
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            12 views
            0 likes
            Last Post maybeimnotrader  
            Started by quantismo, Today, 05:13 PM
            0 responses
            7 views
            0 likes
            Last Post quantismo  
            Working...
            X