Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Apply an indicator only on the last day

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

    Apply an indicator only on the last day

    Hi all,

    I've scanned through the forum very quickly but couldn't find I think a simple answer.

    Is there a way to show extended lines for an indicator only on the last trading day ?

    For example if I ask for a chart from 1/12009 to 1/6/2009 only draw extended lines for day 1/6/2009


    Thanks Bernard

    #2
    Bernard, I believe you could just query if you're calling OnBarUpdate() on the current day and then use DrawExtentedLine() instead of DrawLine() as method.

    Comment


      #3
      I have tried :
      if(DateTime.Now == DateTime.Today)

      but it doesn't work

      Bernard

      Comment


        #4
        No, as DateTime.Now will give you today's date and current time and DateTime.Today will give you today's date, but 12:00 AM.

        Try comparing the date portion so -

        Code:
         
        if(ToDay(DateTime.Now) == ToDay(DateTime.Today))

        Comment


          #5
          Bertrand

          It doesn't work because it is always showing equality...

          I printed the result on the output window and they showed always equality. It makes sense because I am asking if Date time now is equal to today..

          What I want to compare is the date of the current bar. Is it equal to today ?

          I don't know how to code that


          Bernard

          Comment


            #6
            Here is how I solved the problem :

            if( ToDay(Time[0]) == ToDay(DateTime.Today))





            Bernard

            Comment


              #7
              You're correct Bernard, sorry for the extra spin...great you got it working.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              581 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              338 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 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
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X