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 SalmaTrader, 07-07-2026, 10:26 PM
              0 responses
              35 views
              0 likes
              Last Post SalmaTrader  
              Started by CarlTrading, 07-05-2026, 01:16 PM
              0 responses
              20 views
              0 likes
              Last Post CarlTrading  
              Started by CaptainJack, 06-17-2026, 10:32 AM
              0 responses
              12 views
              0 likes
              Last Post CaptainJack  
              Started by kinfxhk, 06-17-2026, 04:15 AM
              0 responses
              18 views
              0 likes
              Last Post kinfxhk
              by kinfxhk
               
              Started by kinfxhk, 06-17-2026, 04:06 AM
              0 responses
              21 views
              0 likes
              Last Post kinfxhk
              by kinfxhk
               
              Working...
              X