Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ToDay() && ToTime()

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

    ToDay() && ToTime()

    Hello,
    I'm trying to debug my code and I'd like to narrow down the area that I search so I don't have to scroll so much through the Output Window. I'm wondering if there is a way to use the ToDay() and ToTime() together to pick specific days and times. I've tried encapsulating my code with the these methods but nothing returns in the Output Window. Can someone help me with this please?
    Thanks

    #2
    Post your code for review and what you are hoping it does.

    Comment


      #3
      Hello CaptainAmericaXX,

      Thank you for your post.

      Are you using Print() for the values?
      Are you checking ToDay() and ToTime() in a condition?

      Can you provide the code you use for Print(), ToDay(), ToTime(), and any conditions used for these items?

      Comment


        #4
        Thank you for the reply's. Here is a section of the code.
        Code:
        if(ToDay(Time[0]) > 2015107 && ToDay(Time[0])< 2015108) 
                    {
                    if(Close[0] > Close[1] && !established_swing_low)
                    {
                        current_swing_low = Low[0];//establish swing low
                        Print(Time[0] + " Swing Low is " + Low[0]);
                        established_swing_low = true;
                     }
           
                    if(Close[0] < current_swing_low && established_swing_low )
                    { 
                        established_swing_low = false;
                        Print(Time[0] +" Swing was broken at " + Close[0]);
                        top_of_first_leg = current_swing_low;
                        lower_high = current_swing_low;
                        first_leg = true;
                        second_leg = true;
                        after_second_leg = true;
                        after_first_leg = true;
                        Print("SWING LOW RESET");
                    }
                    }
        Thanks

        Comment


          #5
          Originally posted by CaptainAmericaXX View Post
          Thank you for the reply's. Here is a section of the code.
          Code:
          if(ToDay(Time[0]) > 2015107 && ToDay(Time[0])< 2015108)
          Is that October 7 and October 8?
          There's no day in between? Did you want only 10/7? Try >= instead of >

          Also Do a print statement before on the ToDay ().

          (Sorry on mobile, can't dig further)

          Comment


            #6
            Sledge, thanks for the help. Unfortunately adding a day and adding <= did nothing. I tried a Print() with just the ToDate() and got nothing. I'm not showing any errors in the log.
            if(ToDay(Time[0]) >= 2015107 && ToDay(Time[0])<= 2015109)

            {
            Print("This is working");
            }
            Any other suggestions?

            Comment


              #7
              Originally posted by CaptainAmericaXX View Post
              Sledge, thanks for the help. Unfortunately adding a day and adding <= did nothing. I tried a Print() with just the ToDate() and got nothing. I'm not showing any errors in the log.

              Any other suggestions?
              Put the Print before the IF statement with the ToDay Time..

              Your output log will fill up, but you will see your error in your logic.



              Code:
              Print ("The Day is:" + ToDay(Time[0])) ;
              
              if(ToDay(Time[0]) >= 2015107 && ToDay(Time[0])<= 2015109) 
              
              {
              Print("This is working");
              }

              Comment


                #8
                Silly Rabbit! Trix are for kids! (Does the commercial state that any more?). Thanks for working with me on this Sledge. I discovered that 20151007 will work while 2015107 won't. I forgot to add a 0 before the 7. Silly me.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                571 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                330 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
                549 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                549 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X