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

Changes to CurrentDayOHL indicator

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

    Changes to CurrentDayOHL indicator

    I'm in need of some help with the following:
    I'm using the NT "CurrentDayOHL" indicator to trade futures, but would like the High and Low of the indicator to be based on the 8:30 am market open and not the HL for the start of the day.

    I tried making the following changes to the script, but I'm stuck figuring out where I went wrong.

    Thanks in advance.

    OnBarUpdate ()

    if (currentDate != Bars.GetTradingDayFromLocal(Time[0]) || currentOpen == double.MinValue)
    {
    currentOpen = Open[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
    currentHigh = High[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
    currentLow = Low[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
    sameDay = false;
    }

    currentHigh = Math.Max(currentHigh, High[0]);
    currentLow = Math.Min(currentLow, Low[0]);

    if(ToTime(Time[0]) < ToTime(8,30,0))
    {
    currentOpen = Open[0];
    currentHigh = High[0];
    currentLow = Low[0];
    PlotColors[0][0] = Color.Transparent;
    }

    if(currentDate == Bars.GetTradingDayFromLocal(Time[0]) && ToTime(Time[0]) >= ToTime(8,30,0))
    currentOpen = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
    currentHigh = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
    currentLow = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];

    #2
    Hello 2Look4me,

    I would not suggest changing the code of the CurrentDayOHL indicator to accomplish this.

    I would suggest that instead, you create a custom session template with the hours you specify.

    Below is a link to the help guide on session templates.
    http://www.ninjatrader.com/support/h...on_manager.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea, thanks for the suggestion, but changing the session template will create issues with other indicators that I'm using. Therefore, having an indicator that calculates the HL at the market open is more appropriate for my purposes.

      On the other hand, any suggestions in terms of how to code this properly?

      Comment


        #4
        Hi 2Look4me,

        While we cannot assist with the logic for this, we do have a list of professional NinjaScript Consultants who would be happy to assist you with this kind of logic.

        Below is a publicly available link to a list of professional NinjaScript Consultants.
        http://ninjatraderecosystem.com/Part...ultants.php#81

        This thread will also remain open for any other community members that would like to assist with this custom logic.
        JaredNinjaTrader Ecosystem

        Comment


          #5
          Hi Jared,

          Thanks for your reply and for your suggestion to go somewhere else.

          I was under the impression that I was accessing the "Indicator Development" support forum and my understanding is that this forum is precisely for assisting NT users as they develop indicators.

          In the couple months since I joined, I have enjoyed the product and the forum support. I've read many of the the forum threads and more often than not, NT users are assisted with their own logic and scripting. Please pay attention that I DID NOT ask to have an indicator created from scratch, but I spent hours working on it and needed some additional help.

          NT is a great product. But a product is not great just by itself, the technical support is as equally important.

          I wonder if your reply to my thread is just your personal opinion (you have only posted 17 times as a moderator) or is this the new and improved direction that NT will be taking? If I would have known just a month earlier that NT will no longer help with logic and scripting as users develop indicators, I WOULDN'T have voted for Ninjatrader and given it an excellent review.

          Furthermore, if NT users cannot be assisted with indicator development logic, then the NT development support forum should be shut down.

          Comment


            #6
            Hi 2Look4me,

            Here in the NinjaTrader Support department we are not able to assist with coming up with logic for an indicator.

            We are not able to create / modify / or debug script for clients. This is because we have partners who's business model is to help clients with this kind of logic work. If we were to offer this kind of help to clients for free, we would in effect be directly competing with our partners and their business models. This is not good to maintain a healthy ecosystem with many partners. We would also not be able to offer our support for free, as logic can take considerable amounts of time to work out, implement, and test in a NinjaScript strategy or indicator and we would have to considerable increase our staff to be able to handle creating / modifying logic for clients and would no longer be able to keep our subscription fees low.

            Basically, we don't want to steal business away from our partners who's entire business model is to offer these type of services and then offer this for free. We would also not be able to maintain a high level of service for our clients.

            We are able to help with understanding how to use any particular NinjaScript item.
            We can assist if you are getting compile errors that you are unable to resolve.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea,

              You posted: "We are not able to create / modify / or debug script for clients...." I did not ask for help to create/ modify or debug script. I believe that my posting is not far off from many other threads.

              Chelsea, for future reference can you be kind enough to explain how does my request differ from the previous recent threads that you answered? Is there a chance that you misunderstood what I posted?

              Combine VolumeUpDown and Heiken Ashi
              change of style in ray
              Looking for Horizontal Line with Label on Y-axis
              difficulty plotting indicator
              indicator development-Draw region syntax and Time

              Comment


                #8
                The indicator you look for already exists:



                To display the RTH high and low (plus fib retracments) please select an appropriate session template and add the anaCurrentDayOHLV43 to your chart and set it to RTH/second session.

                The session template which is required should divide the ETH session (contractual trading times) of the instrument into three sections. You can create such templates as needed for the instruments that you trade.

                Below attached is a sample template and a sample chart for YM showing the regular high and low for the last two days. The indicator has a lot of other options such as displaying noise bands (similar to Toby Crabel's stretch) and targets based on the average daily range, all derived from the regular session.
                Attached Files

                Comment


                  #9
                  Harry,
                  Thanks for your time in answering and for the detailed info. I will check it out.

                  Comment


                    #10
                    2Look4me, Chelsea and Jared raised valid points and also this is how this forum has always been operated. We would not provide custom coding or provide code modification services, what we will offer (and oftentimes more) is offer assistance for users working their custom studies in NinjaScript and especially review any unexpected issues seen to understand if there may be a underlying framework issue contributing. We understand there's a grey area involved for sure and for this request one idea you could look into incorporating would be simply a time filter to prevent the logic being processed in OnBarUpdate(), so you would place a check at the very top of this method. This would demand for the bar timestamp to fall into the 830 <> 1515 range to process the logic following this statement.

                    if (ToTime(Time[0]) <= 83000 || ToTime(Time[0]) > 151500)
                    return;

                    I feel this will help you get going in the desired direction on this study, however should it require further coding please be sure to check into the consultants resources Jared has kindly provided earlier.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Bertrand,
                      Thanks again for your kind explanation and for your assistance. I do now understand and agree with your comment that there's a grey area involved as you all provide forum support. My apologies if I crossed the line as I asked for help, for those were not my intentions.

                      Cheers and keep up the good work !

                      Comment


                        #12
                        This might be relevant to this thread wondering if there was a simple way to just plot the open tick at a time of your choosing without messing around with templates? The anaCurrentDayOHLV43 does a good job if you are not using a 24 hours session template and the other ana ones allow offsets but doesnt always plot the past where you can see it correctly...

                        just looking for a simple open tick price line at the time of my choosing....and would draw the line the rest of the day. really simple it seems but can't seem to find the answer anywhere.

                        thanks in advance!

                        Comment


                          #13
                          Originally posted by chinapassage View Post
                          This might be relevant to this thread wondering if there was a simple way to just plot the open tick at a time of your choosing without messing around with templates? The anaCurrentDayOHLV43 does a good job if you are not using a 24 hours session template and the other ana ones allow offsets but doesnt always plot the past where you can see it correctly...

                          just looking for a simple open tick price line at the time of my choosing....and would draw the line the rest of the day. really simple it seems but can't seem to find the answer anywhere.

                          thanks in advance!
                          I agree with your evaluation. The session template was mainly needed to allow for toggling between instruments. If you save the specific session templates under instrument settings, you can toggle between different instruments without setting the opening time, GC will have an opening time of 8:20 AM, CL will have an open at 9:00 AM and ES at 9:30 AM, etc. and you do not need to set those times each time that you select a different instrument.

                          Alternatively I could have used a small database that allows to set the opening time for different instruments and integrate it with the indicator.

                          If you do not need the comfort to toggle between instruments, it is a simple task to code an indicator that displays just the open at a specific time (timezone and time to be selected by the user).

                          Comment


                            #14
                            easy says the professional coder :-) i tried to tinker with your 2500 lines of code in the anaIBrangeBandsV42MTF to come up with it then i thought i am gonna break something so i put it to rest before any national disasters occurred.

                            i am thinking this has to be out there already as it something everyone uses at one time or another so instead of creating a Frankenstein thought this might be the place where someone knew it was already created and available.

                            Comment


                              #15
                              Hello chinapassage,

                              The tools you need to make an indicator like this are:

                              A public parameter for the user to enter a start time and end time.

                              These can be timespans OR a combination of int hour, int minute, int second.

                              Then you will need to compare the time of the current bar and see if this time is after the start time and before the end time. If it is, then save the first tick price to a double variable.

                              Use a bool to only save this price to the variable once.

                              To compare a date time with a timespan use ToTime().
                              http://www.ninjatrader.com/support/h...nt7/totime.htm
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by devatechnologies, 04-14-2024, 02:58 PM
                              3 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by tkaboris, Today, 08:01 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post tkaboris  
                              Started by BarzTrading, Today, 07:25 AM
                              1 response
                              11 views
                              1 like
                              Last Post NinjaTrader_Clayton  
                              Started by EB Worx, 04-04-2023, 02:34 AM
                              7 responses
                              161 views
                              0 likes
                              Last Post VFI26
                              by VFI26
                               
                              Started by Mizzouman1, Today, 07:35 AM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Working...
                              X