Lipi Reference Lipi

Functions

talib.crossover()

The source1-series is defined as having crossed over source2-series if, on the current bar, the value of source1 is greater than the value of source2, and on the previous bar, the value of source1 was less than or equal to the value of source2.

Syntax

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

Arguments

source1 required series float First data series.
source2 required series float Second data series.

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)