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;
    BertrandNinjaTrader Customer Service

    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...
        BertrandNinjaTrader Customer Service

        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;
            BertrandNinjaTrader Customer Service

            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.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by helpwanted, Today, 03:06 AM
                0 responses
                3 views
                0 likes
                Last Post helpwanted  
                Started by Brevo, Today, 01:45 AM
                0 responses
                6 views
                0 likes
                Last Post Brevo
                by Brevo
                 
                Started by aussugardefender, Today, 01:07 AM
                0 responses
                5 views
                0 likes
                Last Post aussugardefender  
                Started by pvincent, 06-23-2022, 12:53 PM
                14 responses
                242 views
                0 likes
                Last Post Nyman
                by Nyman
                 
                Started by TraderG23, 12-08-2023, 07:56 AM
                9 responses
                384 views
                1 like
                Last Post Gavini
                by Gavini
                 
                Working...
                X