☕How cross over,cross under,over,under work ?

Checking cross over, cross under at candle x:
Take two points at candle x and previous 1 candle of x on the blue line (b[x-1],b[x]) and two points on the red line (r[x-1],r[x])
If b[x-1] < r[x-1] and b[x] > r[x] => blue line cross over red line.
If b[x-1] > r[x-1] and b[x] < r[x] => blue line cross under red line.
A cross must really change side. If the two lines are equal on either candle, it is not a cross — touching is not crossing.
Note: in case the condition is Price cross over/cross under.... if you select price to check:
C-C: take the two points close of the previous candle of x and close of candle x (c[x-1],c[x])
O-C: take the two points open and close of candle x (o[x],c[x])
H-L: take the two points high and low of candle x, in the direction the candle moved: a green candle (close above open) is read low → high (l[x],h[x]), a red candle is read high → low (h[x],l[x]). This is what lets a single candle's wick cross a line up or down.
Checking over, under at candle x:
Take one point at candle x on the blue line (b[x]) and one point on the red line (r[x])
If b[x] >= r[x] => blue line over red line.
If b[x] <= r[x] => blue line under red line.
Equal values count as both over and under, because only one candle is read and there is no direction to decide.

Which candle is "x" ? The one you pick in Candle To Check — see How "candle to check" work ?. Remember that cross over / cross under also read the candle before x, so a cross is never decided by one candle alone.
Want the same thing to happen more than once ? See How "Multi-Candle" work ? — the check above is then repeated on every candle of the window.
Want to filter how far apart the two lines are ? See How "Distance limit" work ? — the distance is an extra filter on top: the condition above must be true and the distance must match.
Last updated
