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

Hi-Low-Middle of previous day

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

    Hi-Low-Middle of previous day

    This is rather simple but can not find it. Looking for an indicator that Draws 3 Lines at end of session, Hi, Low & Middle of trading day & extending to Next Day but not the day after.

    #2
    I believe the easiest approach would just be to use PriorDayOHLC()
    https://ninjatrader.com/support/help...injascript.htm

    Define a double for the high, one for the low and one for the average (divided the sum of the High+Low by 2). That will give you the prices to use with Draw.Line

    Than for start and end times of the Draw.Line() you could just use;

    double BarVal = BarsPeriod.Value;
    DateTime StartTime = Time[0].Date.AddDays(-1).AddHours(XX).AddMinutes(XX + BarVal);
    DateTime EndTime = Time[0].Date.AddHours(XX).AddMinutes(XX + BarVal);

    Since NT uses end bar time as bar time, adding the BarVal will allow you to have the indicator adjust with timeframes, so if you defined time of 9 hours and 30 minutes, if it was a 5min chart, it would have that time as 935, which would be the 930 open candle. Defining the StartTime to use the day prior with AddDays(-1) and extending it to XX:XX time on current day with EndTime.

    -Chris
    Last edited by ChrisR; 06-06-2023, 04:46 PM.

    Comment


      #3
      Originally posted by FishTrade View Post
      This is rather simple but can not find it. Looking for an indicator that Draws 3 Lines at end of session, Hi, Low & Middle of trading day & extending to Next Day but not the day after.
      PriorDayOHLC can do this, except for that 'Middle' part.

      You can turn off the Open & Close lines, as desired.

      Suggest you copy that indy and use it as the basis for
      your own custom script ... sounds like it would an easy
      addition.

      Comment


        #4
        Hello FishTrade,

        Thanks for your post.

        ChrisR and bltdavid are correct. The PriorDayOHLC indicator could be used to get the PriorDayOHLC.PriorHigh and PriorDayOHLC.PriorLow values and assign those values to a plot.

        The "Middle" values could be calculated by adding the PriorDayOHLC.PriorHigh and PriorDayOHLC.PriorLow values and dividing by 2. That calculation could be assigned to a plot.

        For example:

        double midValue = (PriorDayOHLC().PriorHigh[0] + PriorDayOHLC().PriorLow[0])/2;

        See the help guide documentation below.

        PriorDayOHLC: https://ninjatrader.com/support/help...b=priordayohlc
        AddPlot(): https://ninjatrader.com/support/help...ghtsub=addplot
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 06:23 AM
        2 responses
        6 views
        0 likes
        Last Post kujista
        by kujista
         
        Started by f.saeidi, Today, 08:03 AM
        0 responses
        4 views
        0 likes
        Last Post f.saeidi  
        Started by cre8able, 04-17-2024, 04:16 PM
        7 responses
        64 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Aviram Y, 08-09-2023, 09:04 AM
        11 responses
        299 views
        0 likes
        Last Post arjandezeeuw  
        Started by Christopher Leggit, 02-15-2024, 09:00 AM
        3 responses
        47 views
        0 likes
        Last Post rdtdale
        by rdtdale
         
        Working...
        X