Lipi Reference Lipi

Functions

talib.crossover()

Flags the bar on which `source1` crosses above `source2`. Crosses the other way are ignored.

Syntax

                talib.crossover(series float source1, series float source2) → series bool
              

Arguments

source1 required series float The series doing the crossing.
source2 required series float The series being crossed.

Return Type

series bool

Example


          indicator("Crossover Example", overlay=true)
length1 = input.int(10, title="Fast MA Length")
length2 = input.int(20, title="Slow MA Length")
fastMA = talib.sma(close, length1)
slowMA = talib.sma(close, length2)
crossover = talib.crossover(fastMA, slowMA)
crossunder = talib.crossunder(fastMA, slowMA)
plot(fastMA, color=color.blue, title="Fast MA")
plot(slowMA, color=color.red, title="Slow MA")
plotshape(crossover, title="Crossover", location=location.belowbar, color=color.green, shape=shape.triangleup, size=size.small)
plotshape(crossunder, title="Crossunder", location=location.abovebar, color=color.red, shape=shape.triangledown, size=size.small)