Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Re paint chart

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

    Re paint chart

    I have an indicator that colors the backcolor at certain market times based on a condition.

    I use

    if(condition)

    BackColorAll = Color.Pink;

    This works great but once the event is over I wish to reapply the 'default' BackColor to that area.
    Is there a way to do this?

    At the moment the only way I can do it is to hit F5 and reload.

    #2
    Mindset, please try adding an else condition to change to your needed default color -

    Code:
     
    if(condition)
    
    BackColorAll = Color.Pink;
     
    else
     
    BackColorAll = Color.White;

    Comment


      #3
      won't repaint

      but that won't repaint the old bars will it?

      Comment


        #4
        Not sure I follow, the switch would be done according to the condition you've defined for all bars the OnBarUpdate() is called for for the leftmost to the current going forward...

        Comment


          #5
          better explanation

          if (diff.TotalMinutes < alerttimel )

          {

          BackColorAll = Color.Pink;
          }

          So my condition is a time limited condition - not price based. If I put the else statement in - the pink doesn't show.

          What I currently get left with is pink at the duration of my alerttime as a band which is quite nice and informative but not what I want!!

          Comment


            #6
            Then use something like this adjusted to your times needed -

            Code:
             
            if (ToTime(Time[0]) > 93000 && ToTime(Time[0]) < 100000)
            BackColorAll = Color.Blue;
            else
            BackColorAll = Color.Empty;

            Comment


              #7
              timespan

              Bertrand
              I am using a timespan var to countdown the minutes so I don't think that will work?

              Comment


                #8
                Hmm, would think so to without getting into the code - you would need to relate this condition then to the bar's timestamp then.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                29 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                117 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 05-10-2026, 08:12 PM
                0 responses
                69 views
                0 likes
                Last Post CarlTrading  
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                227 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Started by Mindset, 04-21-2026, 06:46 AM
                0 responses
                309 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X