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

Time range indicator

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

    Time range indicator



    I've found a couple versions of this indicator. It is supposed to draw a line at the low and high of whatever times are selected. But the problem I keep having with it is that it doesn't include the very first bar of the day. I do not have the ability to code this for myself so I'm hoping that someone may have already fixed this and would be willing to share it.

    Thanks

    #2
    Kfox_1,

    Hopefully another community member can modify for you.

    This indicator doesn't start plotting until after the end hour has passed. This is expected since it's not possible to set an historical plot value that is based on future data.

    One alternative here is using drawing objects to draw on the historical levels, similar to my indicator here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Daily Levels

      Your code works very well for the day as a whole and appears to be quite accurate. I don't think I was very clear though on what the code I posted does. It's supposed to plot trend lines at the high and low of the times selected. So for example if I want to see lines drawn to show the range of the first thirty minutes of the day this code is supposed to do that and extend them til the close. What happens however is that if the first bar on the chart turns out to be the actual low of the first thirty minute period it doesn't show that. It shows the second bars low. So what's happening is that the first bar of the day( regardless of time frame selected) isn't used as part of the calculation.

      The way your code works appears to calculate everything properly. Is it possible to have an EndTime function added to it so that it will stop adding higher/lower prices after the end time? Obviously I'd still like the lines to plot to the end of the day.

      Sorry to be such a bother it's just that with the free version of NT I'm not able to build my own codes.
      Thanks

      Comment


        #4
        I see what you're saying. If this is consistent across every session, you should be able to modify pretty easily.

        If you wanted one additional bar to be included you can add + 1 to the MAX and MIN bars ago values.

        double highestHigh = MAX(High, (startBarsAgo - endBarsAgo) + 1)[endBarsAgo];


        You can modify and create your own code with the free simulated version of NinjaTrader. Please access the below link to register for your own free license key at : http://www.ninjatrader.com/download-registration.php
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Sim key

          Thank you very much for the key to use so I can do my own work. I wasn't aware of this.

          Many thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rhyminkevin, Today, 04:58 PM
          3 responses
          48 views
          0 likes
          Last Post Anfedport  
          Started by iceman2018, Today, 05:07 PM
          0 responses
          5 views
          0 likes
          Last Post iceman2018  
          Started by lightsun47, Today, 03:51 PM
          0 responses
          7 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          14 views
          0 likes
          Last Post 00nevest  
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          50 views
          0 likes
          Last Post futtrader  
          Working...
          X