Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculating overnight Hi and Low indicator..

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

    Calculating overnight Hi and Low indicator..

    Dear NT Support,

    We are using NT7v19, and in our Ninjascript automated strategy we have been using the @CurrentDayOHL indicator to have the strategy enter our orders in relation to the ES overnight Hi and Low, and while running our strategy on a live ZenFire data feed for our simulator the strategy has been properly calculating the overnight Hi and Low (from 3:30pm the previous day until 8am when we enter our strategy). But recently we have started taking our automated strategy live, and now the @CurrentDayOHL indicator seems to now be no longer functioning properly (it no longer is calculating the overnight Hi and Low correctly), in fact it seems to be taking the Hi and Low during the time that the computer is logged on to NT and basing its entry off of that range (instead of the true overnight Hi and Low). The only other thing that is different while we are running our strategy live is that instead of a ZenFire connection, we now have PatSystems connection.

    Any ideas on why our @CurrentDayOHL indicator is no longer functioning properly? Perhaps something to do with us being live? or some quirks with PatSystems? Any suggestions on how we can get the @CurrentDayOHL indicator to work properly or alternative indicators to calculate the overnight Hi and Low?

    Thanks for your time and assistance..

    #2
    Hello sev888,

    Unfortunatey Patsystems does not support historical data, so it will not be able to load historical data for the current day - it will use OHL values for the data you received in real-time.

    You will need to connect to a connectivity provider that supports historical data.
    Last edited by NinjaTrader_Jason; 07-22-2010, 05:39 AM.

    Comment


      #3
      That's ridiculous, why doesn't Patsystems support historical data? If I'm connected to NT through Patsystems, how is it that my SuperDom know where the overnight Hi and Low is (as I can easily set it to show the Hi and Low), and yet Patsystems can not support such an indicator? If not from an indicator, then how can I code my ninjascript so that it reads the Hi and Low from the the SuperDom? Thanks..

      Comment


        #4
        Unfortunately I am not sure why historical data is not supported by Patsystems.

        I will check with a colleague if you can refer the High and Low from the SuperDOM in your NinjaScript code.

        Comment


          #5
          You can use the High and Low that are displayed in the SuperDOM in NinjaScript. Please see the following link.


          Please use it in the OnMarketData() method.

          Comment


            #6
            Jason,

            If sev queries the DOM for the Daily High and Low, won't OnMarketData ONLY update with the DailyHigh and DailyLow values IF a DailyHigh or DailyLow value is set at the time he queries? Is there a way to "ASK" or "QUERY" NT for the DailyHigh and DailyLow of the ETH session?

            thanks-



            Originally posted by NinjaTrader_Jason View Post
            You can use the High and Low that are displayed in the SuperDOM in NinjaScript. Please see the following link.


            Please use it in the OnMarketData() method.
            Last edited by jonmoron; 07-22-2010, 10:32 AM.

            Comment


              #7
              jonmoron,

              To clarify, getting DailyHigh or DailyLow is not something you choose based on a session template. This is something provided by the data provider and is just passed along to you as-is. This will only be available in OnMarketData() at the moment the data provider pushes those data. You would then want to save them and hold onto them till the next time the data provider updates those values.

              If you are simply trying to get daily high and low from the chart you can simply use the CurrentDayOHL() indicator. Running it on a ETH sessioned chart results in the daily high/low of the ETH session. Running it on RTH will result in RTH daily high/low.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Josh,

                That's the issue for sev. The issue is that we cannot 'simply use CurrentDayOHL() on the ETH session because the high and low that the indicator gives us is the high and low since we've been running the ninjascript. Like sev mentioned, we're using this indicator/strategy combination on PatsSystems and it seems like there is a historical data issue with PatsSystems that renders this indicator useless.

                I was asking if there was any OTHER way of querying NinjaTrader for the day's High and Low (since CurrentDayOHL() indicator does NOT work). So, is there?

                thanks!

                Originally posted by NinjaTrader_Josh View Post
                jonmoron,

                To clarify, getting DailyHigh or DailyLow is not something you choose based on a session template. This is something provided by the data provider and is just passed along to you as-is. This will only be available in OnMarketData() at the moment the data provider pushes those data. You would then want to save them and hold onto them till the next time the data provider updates those values.

                If you are simply trying to get daily high and low from the chart you can simply use the CurrentDayOHL() indicator. Running it on a ETH sessioned chart results in the daily high/low of the ETH session. Running it on RTH will result in RTH daily high/low.

                Comment


                  #9
                  jonmoron,

                  In my previous post I mentioned those values are only available when the data provider pushes them and you will receive them in OnMarketData(). To clarify, this means there is no way to get them until you receive such an event. There is no querying.

                  If historical data is the issue, it may be worth considering getting a dedicated data service.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Josh,

                    Understood. So in the event that a new DailyHigh or a new DailyLow has been made, OnMarketUpdate will contain the new DailyHigh or DailyLow? How about if I use the code below:

                    OnMarketUpdate()
                    {
                    dailyHigh = MarketDataType.DailyHigh;
                    dailyLow = MarketDataType.DailyLow;
                    }

                    Wouldn't this code get called when any level of the Market Depth gets updated? And if so, won't the local vars dailyHigh and dailyLow get set appropriately?

                    Originally posted by NinjaTrader_Josh View Post
                    jonmoron,

                    To clarify, getting DailyHigh or DailyLow is not something you choose based on a session template. This is something provided by the data provider and is just passed along to you as-is. This will only be available in OnMarketData() at the moment the data provider pushes those data. You would then want to save them and hold onto them till the next time the data provider updates those values.

                    If you are simply trying to get daily high and low from the chart you can simply use the CurrentDayOHL() indicator. Running it on a ETH sessioned chart results in the daily high/low of the ETH session. Running it on RTH will result in RTH daily high/low.

                    Comment


                      #11
                      No, that will not work. MarketDataType is an object type. It does not contain any values. What contains the value is the MarketDataEventArgs e object.

                      All you need to do is create yourself two double variables. Then filter the OnMarketData() method for the correct MarketDataType. When the OnMarketData() method receives an event with the appropriate MarketDataType then set the value of that event to the double variable and then you will have it for use in your code.

                      Code:
                      private double dailyHigh = 0;
                      private double dailyLow = 0;
                      
                      protected override void OnMarketData(MarketDataEventArgs e)
                      {
                           if (e.MarketDataType == MarketDataType.DailyHigh)
                                dailyHigh = e.Price;
                           else if (e.MarketDataType == MarketDataType.DailyLow)
                                dailyLow = e.Price;
                      }
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Josh,

                        So this won't solve our problem in regards to 'knowing' the overnight high/low at any given time? The daily high and daily low will have to be set in order for dailyHigh or dailyLow to be correctly set.

                        Since the indicator @CurrentDayOHL doesn't work with PatsSystems, is our only solution using a market data provider that supports historical data?




                        Originally posted by NinjaTrader_Josh View Post
                        No, that will not work. MarketDataType is an object type. It does not contain any values. What contains the value is the MarketDataEventArgs e object.

                        All you need to do is create yourself two double variables. Then filter the OnMarketData() method for the correct MarketDataType. When the OnMarketData() method receives an event with the appropriate MarketDataType then set the value of that event to the double variable and then you will have it for use in your code.

                        Code:
                        private double dailyHigh = 0;
                        private double dailyLow = 0;
                        
                        protected override void OnMarketData(MarketDataEventArgs e)
                        {
                             if (e.MarketDataType == MarketDataType.DailyHigh)
                                  dailyHigh = e.Price;
                             else if (e.MarketDataType == MarketDataType.DailyLow)
                                  dailyLow = e.Price;
                        }

                        Comment


                          #13
                          Correct. Your options are either to simply leave NT running 24/7 to collect all data you want so you can have the historical data or consider acquiring a historical data service.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            NT_Josh and NT_Jason,

                            One point of confusion I (as well as sev888) have is where exactly is the SuperDOM getting its session High and Low numbers from? For whatever reason, the SuperDOM is always correct, even when we're using PatsSystems and the Low/High was set before we opened up the strategy/DOM. There must be someway that the SuperDOM is getting the Daily High and Low -- My question is...where is it getting the data from and how do I access it?

                            thanks!


                            Originally posted by sev888 View Post
                            That's ridiculous, why doesn't Patsystems support historical data? If I'm connected to NT through Patsystems, how is it that my SuperDom know where the overnight Hi and Low is (as I can easily set it to show the Hi and Low), and yet Patsystems can not support such an indicator? If not from an indicator, then how can I code my ninjascript so that it reads the Hi and Low from the the SuperDom? Thanks..

                            Comment


                              #15
                              jonmoron,

                              Spoke with development, unfortunately this is not supported. The options in my previous posts will continue to be the case.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              95 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              50 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              31 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              35 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              72 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X