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

Accessing Globex instrument's last N night session's Min and Max prices

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

    Accessing Globex instrument's last N night session's Min and Max prices

    I am sure that you understand the problem but let me repeat it so you can catch any misunderstanding that I may have. The Globex futures instruments that I trade have day and night sessions. Using Central Time, the E-mini S&P 500 futures contract ES's day sessions trades 8:30-15:15 Monday thru Friday. The night sessions trade 15:30-8:15 weekdays and Sunday 17:00-8:15.

    The NT charts that I watch while trading have Session Begins properties of 8:30 AM and Session Ends of 4:15 PM. As I understandings it, only instrument data between Session Begins and Session Ends are seen by an indicator's OnBarUpdate() method and there are no objects that have the data that is outside the Session Begins and Session Ends times.

    I want to use the last N night session's Min and Max prices in my indicator. I am looking for the simplest NT 6.5 solution and have come up with this:

    1) Create a chart that has Session Begins - Session Ends of 15:30 - 8:15, which will capture all the night session data, including Sunday's.

    2) Create an indicator which:

    a) Uses the technique in Reference Sample "Indicator: Using custom events to output the current Level II data book" to create custom event from a Timer object to signal the end of the night session.

    b) When the night session ends, use C# .NET static variables to save instrument's last N night session's Min and Max prices.

    3) Update my indicators to get the last N night session's Min and Max prices from the static variable for the chart instrument.

    Is this the simplest solution to get last N night session's Min and Max prices?

    The disadvantage of this solution is that it requires an additional chart for each instrument to collect the night session data. This could be eliminated if there was an OnNoBarUpdate() method that would see all trades that were filtered out by Session Begins - Session Ends. Is something like that technically possible?
    Last edited by Jim W.; 03-09-2008, 03:08 PM.

    #2
    The approach you have outlined should work. Unfortunately there is no OnNoBarUpdate() method available. You can roll your own method from the reference sample you linked to. It doesn't have to only be a timer. You can create your own trigger events.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Your reference examples are great. It so helpful to begin with working code rather than starting from scratch. Thanks!

      I know that NinjaScript provides Bars.FirstBarOfSession, Bars.SessionBreak , Bars.PercentComplete, and Bars.BarsSinceSession. But, I have not found any way of determining in an indicator that the current bar is the last bar in a session, for charts with user entered Session Begins - Session Ends filtering. Is this possible in NT 6.5?

      Does the OnBarUpdate() method's property Bars.PercentComplete return a value of 1 at the Session Ends time or just before the next Session Begins time? In other words, if I updated the instrument's static variable each time Bars.PercentComplete returned a value of 1, would I be sure to get all the data in the night session before the day session starts?
      Last edited by Jim W.; 03-09-2008, 07:37 PM.

      Comment


        #4
        Unfortunately there is no BarsFinished logic. You will just have to mimic what you want. Check the timestamp of the last bar and if it matches your SessionEnd you know it is the last bar or something like that.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          My indicator that shows Globex and day price ranges

          I have finished my indicator which displays day and Globex session information and am pleased with the results.

          My final design uses two Workspaces. The Days Session's Workspace has my trading charts and the Night Session's Workspace has charts for only those Instruments that I want to collect Globex Session information.

          An indicator of mine runs in each Night Sessions chart. When a bar ends with a higher High or lower Low then the Night Session indicator updates my Day Sessions Indicator's parameters in the Day Session's Workspace using C# Regular Expressions.

          Each morning I close the Night Session's Workspace and open the Day Session's Workspace. My Day Session indicator displays, to the right of the zero bar, the previous Day Session Ranges in Gold and the Night Session Ranges in plum. Click on thumbnail to see example.
          Attached Files
          Last edited by Jim W.; 06-10-2008, 01:45 PM. Reason: Updated chart

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,789 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          837 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,293 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          13 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          63 views
          0 likes
          Last Post halgo_boulder  
          Working...
          X