kodmanyagha
kodmanyagha

Reputation: 985

Detect SRSI crossing number on tradingview and pinescript

I want to get SRSI junction. I can receive SRSI crossing event in tradingview but I can't get junction.

For example: srsi crossing nubmers

I want to get these numbers and crossing status. 85:short, 20:long: 90:short something like that. Is this possible on tradingview or any other platform like metatrader etc.

Upvotes: 0

Views: 119

Answers (1)

vitruvius
vitruvius

Reputation: 21219

You can use crossover() and crossunder() functions for that.

crossover()

The x-series is defined as having crossed over y-series if the value of x is greater than the value of y and the value of x was less than the value of y on the bar immediately preceding the current bar.

crossunder()

The x-series is defined as having crossed under y-series if the value of x is less than the value of y and the value of x was greater than the value of y on the bar immediately preceding the current bar.

Then you can combine these with simple logic operations.

short = (line1 > 85) and (crossunder(line1, line2))
long = (line1 < 20) and (crossover(line1, line2))

Upvotes: 1

Related Questions