Returns true on the bar where source1 moves from at or above source2 to below it.
ta.crossunder is true when source1 < source2 on this bar and source1 >= source2 on the previous bar. The second argument can be a level, a number or another series.
The result is true for one bar per cross, and false on the first bar and wherever an na is involved.
Syntax
ta.crossunder(source1: series int/float, source2: series int/float) -> series boolArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source1 | series int/ | required | The series expected to move down through the other. |
| source2 | series int/ | required | The series or level being crossed. |
Returns
series bool: true on the crossing bar, otherwise false.
Remarks
- Use
ta.crosswhen the direction does not matter.
Example
//@version=6
indicator("RSI exit", overlay = false)
r = ta.rsi(close, 14)
plot(r, "RSI", color = color.purple)
hline(70)
bgcolor(ta.crossunder(r, 70) ? color.new(color.red, 80) : na)See also
Runs on Sidechair