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 usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        23 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        22 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Working...
        X