- Topics: 69
- Replies: 737
- Posts: 806
By default the KC() function uses the upper line value in the output when nothing else is specified, so you need to select the centre line in one of the variables, along with the required CLOSE() condition.
When creating a new script it’s best to start from scratch and use the pop-up boxes to build the formula as syntax from other scripts may not be relevant for what you are trying to achieve.
This should do what you need:
// Price Closing Above 21 EMA Average Keltner Band;
C1 = CLOSE() > KC(DEFAULT=CentreLine, BARS=21, STYLE=Exponential);
// Price Closing Below 21 EMA Upper Keltner Band;
C2 = CLOSE() < KC(BARS=21, STYLE=Exponential);
C1 and C2
When used in a Show Bar tool the arrows highlight when both conditions have been met: