I am trying to create an indicator to fire alert whenever it is crossing Down or crossing Up a specific price.
Can anyone help me to create an indicator to fire alert whenever it is crossing down 23000 and crossing up 22000 please. Thanks.
You actually don't need to write code for that if that's the only thing you want. You can do it via the alert settings.
If you want to write your own code for it, you can use ta.crossover()
or ta.crossunder()
functions.
target_price = 100
cross_up = ta.crossover(close, target_price)
cross_down = ta.crossunder(close, target_price)
alertcondition(cross_up, "Cross up")
alertcondition(cross_down , "Cross down")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.