Support Board
Date/Time: Tue, 04 Nov 2025 08:13:33 +0000
[User Discussion] - Key reversal bar using Colour bar based on alert condition (or similar)
View Count: 1859
|   [2015-03-04 18:08:41]     |  
| User96105 - Posts: 113 | 
| 
                Can anyone help with the correct code for this please? I want to show a bar colour change (or an arrow etc) to show key reversal bars ~ where in a downtrend the low is lower than the previous bar, but the close is within the top half of the bar (and conversely up bars). Many thanks.  | 
        
|   [2015-03-04 21:46:28]     |  
| Sawtooth - Posts: 4285 | 
| 
                Try this: =AND(L<L[-1],C>(H-L)/2)  | 
        
|   [2015-03-05 11:12:27]     |  
| User96105 - Posts: 113 | 
| 
                Great, thanks Tom, you set me on the right track. This seems to work for a close in the top/bottom 1/3rd of the bar:- =AND(L<L[-1],C>(H-(H-L)/3)) for a bottom reversal and =AND(H>H[-1],C<(L+(H-L)/3)) for top reverse  | 
        
|   [2020-10-16 14:55:48]     |  
| User616224 - Posts: 6 | 
| 
                Hi, I would like to have Key Reversal indicator, but I can't program, so I don't know where should I put that code. Don't you please have the *.cpp file of it?
                 | 
        
|   [2020-10-16 15:18:04]     |  
| Sawtooth - Posts: 4285 | 
| 
                Add two instances of the Color Bar Based On Alert Condition study, and put each formula in post#3 on the respective Alerts tab of each.
                 | 
        
|   [2020-10-16 16:01:22]     |  
| User616224 - Posts: 6 | 
| 
                I got it. Works beautifully. Thank you!
                 | 
        
To post a message in this thread, you need to log in with your Sierra Chart account:
