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 cay7man, Yesterday, 10:34 AM
        17 responses
        63 views
        0 likes
        Last Post cay7man
        by cay7man
         
        Started by SherwoodJP, 08-31-2023, 02:58 PM
        2 responses
        71 views
        0 likes
        Last Post LunaticEssence  
        Started by habibalex, 01-10-2017, 01:02 PM
        57 responses
        8,639 views
        0 likes
        Last Post yeshe
        by yeshe
         
        Started by pennywise, 06-16-2023, 03:18 AM
        77 responses
        1,753 views
        0 likes
        Last Post GTBrooks  
        Started by supremeMarshall, Today, 10:29 AM
        10 responses
        50 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X