Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Edit Trend Indicator

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

    Edit Trend Indicator

    I've attached an indicator, its a simple indicator I'm trying to develop to help me follow my trend rules.

    It works exactly as I want except for ONE thing, I want it to wait for either high or low of day to be touched AFTER my session start time before it begins to follow the rules based on whichever side it touches. After it touches high or low, it does work properly exactly as I want. It's just that if there's no high or low touch after session start time, it should run at "13" which means no trend or i'd be fine if it returned as NaN or nulled or ran 0.... it's crazy because this seems like the simplest part and i've tried so many things and I just can't get it to wait until high or low of day touch to begin. Can anyone please help me?
    Attached Files

    #2
    Hello imjustkaze,

    "I want it to wait for either high or low of day to be touched AFTER my session start time"

    When the first bar begins forming at the start of a new session, that bar is the open, high, low, and close. Any new high becomes the new high of the session.

    How long are you wanting to wait after the session is open before considering that the 'high'?

    Are you meaning the high of the previous day?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello imjustkaze,

      "I want it to wait for either high or low of day to be touched AFTER my session start time"

      When the first bar begins forming at the start of a new session, that bar is the open, high, low, and close. Any new high becomes the new high of the session.

      How long are you wanting to wait after the session is open before considering that the 'high'?

      Are you meaning the high of the previous day?

      Hi ChelseaB, thank you so much for the response. I'm trading ETH trading hours, I want to include the overnight High and Low. I don't start trading until 08:30, but I want it to reference the Current Day high or low, the way that CurrentDayOHL works. Not just the high or low after my first bar. Does that make sense? If you know how to do that, you'd be saving me so much time, I just can't get it

      Comment


        #4
        Hello imjustkaze,

        You would need to use time conditions and save the high.

        private double overNightHigh;

        In OnBarUpdate():

        if (Bars.IsFirstBarOfSession)
        overNightHigh = High[0];

        if (ToTime(Time[0]) > 170000 && ToTime(Time[0]) < 83000)
        overNightHigh = Math.Max(overNightHigh, High[0]);
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello imjustkaze,

          You would need to use time conditions and save the high.

          private double overNightHigh;

          In OnBarUpdate():

          if (Bars.IsFirstBarOfSession)
          overNightHigh = High[0];

          if (ToTime(Time[0]) > 170000 && ToTime(Time[0]) < 83000)
          overNightHigh = Math.Max(overNightHigh, High[0]);
          I am trying this now and struggling greatly unfortunately, I don't understand why I can't get it to work. When done right, it should return NaN or null or 0 or 13 until the high or low of day is touched and the first trend condition is met. I'm so confused as to why this is so difficult.

          Comment


            #6
            Hello imjustkaze,

            I'm not certain I am understanding.

            "until the high or low of day is touched"

            You mean the high is made from 5:00 PM to 8:30 AM, the price falls after 8:30, and then rises to be equal to or greater than the saved overnight high a second time?

            The high and low would change throughout the day and wouldn't be fully known until the end of the session.

            What time range do you want the high from?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello imjustkaze,

              I'm not certain I am understanding.

              "until the high or low of day is touched"

              You mean the high is made from 5:00 PM to 8:30 AM, the price falls after 8:30, and then rises to be equal to or greater than the saved overnight high a second time?

              The high and low would change throughout the day and wouldn't be fully known until the end of the session.

              What time range do you want the high from?
              Yes, that sounds great, you're with me.

              I'm using CBOE US Index futures ETH hours. So from 5pm to 08:30am is the "overnight range". I want the indicator to not work until a new high, or new low is made first for the "current day" like how the CurrentDayOHL tracks, and adjusts the High and Low line when a new high or low is made? I just want it to wait until a new high or low is made after 08:30. From there, it will correctly change the graph to match the current trend as it should, it does great after it makes a new high or low of day, I just need it to wait until that happens after 08:30 to start working.
              Last edited by imjustkaze; 05-05-2025, 09:42 AM.

              Comment


                #8



                Here is an image of how it would look if it worked properly... see how it returns 13 (which is my number for neither or no trend) until it makes a new high and then it falls into a place where conditions are met for a buy so it drops to 5? it works great after it makes new high or low, i just need it to wait until that new high or low is made after 08:30 am every day

                Click image for larger version

Name:	image.png
Views:	98
Size:	292.9 KB
ID:	1342275
                Attached Files

                Comment


                  #9
                  Hello imjustkaze,

                  The CBOE US Index Futures ETH starts at 3:30 PM Central and ends at 3:15 PM Central the next day, except for sunday at which is starts at 5:00 PM)

                  "I want the indicator to not work until a new high, or new low is made first for the "current day" like how the CurrentDayOHL tracks"

                  What do you consider the current day?

                  As in starting at midnight?

                  Starting at 8:30 AM?

                  Starting at 3:30 PM when the session starts?

                  The CurrentDayOHL().CurrentHigh[0] provides the highest high reached since the start of the session, which would be at 3:30 PM Central.

                  You want to trigger a condition each time a new high is made after 8:30 AM?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hello imjustkaze,

                    The CBOE US Index Futures ETH starts at 3:30 PM Central and ends at 3:15 PM Central the next day, except for sunday at which is starts at 5:00 PM)

                    "I want the indicator to not work until a new high, or new low is made first for the "current day" like how the CurrentDayOHL tracks"

                    What do you consider the current day?

                    As in starting at midnight?

                    Starting at 8:30 AM?

                    Starting at 3:30 PM when the session starts?

                    The CurrentDayOHL().CurrentHigh[0] provides the highest high reached since the start of the session, which would be at 3:30 PM Central.

                    You want to trigger a condition each time a new high is made after 8:30 AM?
                    Hey, thanks again for all your help — I really appreciate your patience as I try to explain this clearly.

                    You're absolutely right about the CBOE US Index Futures ETH session starting at 3:30 PM Central. And yes, CurrentDayOHL().CurrentHigh[0] tracks the highest high since that session start time.

                    Let me clarify what I mean by “current day” in my context:
                    • I consider anything from 3:30 PM (session start) to 8:30 AM the next morning to be part of the overnight range.
                    • For me, I start trading at 8:30 AM Central, which is the NY market open (I'm in Texas, so central timing here.)

                    What I want the indicator to do:
                    • I want it to remain inactive until a new high or new low is made after 8:30 AM. It works exactly as I want after that new high or low is made, I just need it to wait until then to work at all.


                      I used chatgpt for this response to organize my thoughts because I'm known to be terrible at explaining things, hopefully this is a bit clearer, and it's easier for you to help me
                    Last edited by imjustkaze; 05-05-2025, 10:27 AM.

                    Comment


                      #11
                      Hello imjustkaze,

                      private double afterStartTimeHigh;

                      In OnBarUpdate():

                      if (ToTime(Time[0]) == 83000)
                      afterStartTimeHigh = 0;

                      if (ToTime(Time[0]) > 83000 && ToTime(Time[0]) < 151500)
                      {

                      if (High[0] > afterStartTimeHigh)
                      {
                      // This is a new high, trigger some action
                      }

                      // set afterStartTimeHigh to the highest high
                      afterStartTimeHigh = Math.Max(overNightHigh, High[0]);​
                      }
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChelseaB View Post
                        Hello imjustkaze,

                        private double afterStartTimeHigh;

                        In OnBarUpdate():

                        if (ToTime(Time[0]) == 83000)
                        afterStartTimeHigh = 0;

                        if (ToTime(Time[0]) > 83000 && ToTime(Time[0]) < 151500)
                        {

                        if (High[0] > afterStartTimeHigh)
                        {
                        // This is a new high, trigger some action
                        }

                        // set afterStartTimeHigh to the highest high
                        afterStartTimeHigh = Math.Max(overNightHigh, High[0]);​
                        }
                        did I implement the code correctly? I shared a text file

                        I ask becuase if I did unfortunately it didn't work. This picture here is a picture of today starting at 08:30. The cyan dashed lines at the top and bottom are the current day High and Low.

                        Neither have been touched, so the indicator should continue running at 13 throughout the entire session, however, you can see that it starts to change.

                        It's so crazy, because this seems so simple, and yet is proving to be very difficult.

                        Again, I appreciate your help more than you know, this is the last step needed for my automation.

                        Click image for larger version

Name:	image.png
Views:	98
Size:	274.5 KB
ID:	1342290
                        Attached Files

                        Comment


                          #13
                          Hello imjustkaze,

                          The high would change as new highs are made through the time range.

                          You want to trigger a condition each time a new high is made after 8:30 AM and before 3:15 PM, is this correct?

                          It looks like a new high should have been made around 8:35, 8:38, 8:45, 8:57, 8:58, 8:59, 9:21, 9:57, 10:02, 10:17.
                          These are approximate looking at the timestamps on the chart on each bar that appears to have a new high.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hello imjustkaze,

                            The high would change as new highs are made through the time range.

                            You want to trigger a condition each time a new high is made after 8:30 AM and before 3:15 PM, is this correct?

                            It looks like a new high should have been made around 8:35, 8:38, 8:45, 8:57, 8:58, 8:59, 9:21, 9:57, 10:02, 10:17.
                            These are approximate looking at the timestamps on the chart on each bar that appears to have a new high.
                            Just to clarify what I mean by "high of day":
                            I'm not referring to the high of the New York session that begins at 08:30. Instead, I'm referencing the actual high and low of the full trading day, which includes the overnight session.

                            To show this:
                            • In Picture One, you can see that new highs are made after the NY session opens at 08:30. The indicator adjusts the high of day accordingly, shown by the cyan dashed lines.
                            • In Picture Two, using a 3-minute chart to show more context, you can see that the true high (20201.75) and true low (19966.00) of the day are both set overnight. During the NY session (highlighted in yellow from 08:30 to 10:30), neither the high nor low of day is touched.

                            So when I refer to the “high of day,” I mean the full-session high, not just the high of the NY open session. Hope this makes it clearer.


                            Click image for larger version  Name:	image.png Views:	0 Size:	149.8 KB ID:	1342298

                            Click image for larger version  Name:	image.png Views:	0 Size:	173.8 KB ID:	1342297​​
                            Attached Files
                            Last edited by imjustkaze; 05-05-2025, 12:00 PM.

                            Comment


                              #15
                              Hello imjustkaze,

                              private double sessionHigh;

                              In OnBarUpdate():

                              if (Bars.IsFirstBarOfSession)
                              sessionHigh= 0;

                              if (ToTime(Time[0]) > 83000 && ToTime(Time[0]) < 151500 && High[0] > sessionHigh)
                              {
                              // This is a new high reached during the time range, trigger some action
                              }

                              // set sessionHigh to the highest high
                              sessionHigh = Math.Max(sessionHigh, High[0]);​​
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              579 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X