This is a script we use to close all of our orders or positions on any of the integrated exchanges.
You can use a fire once alert with greater than on condition and the alert will typically fire within seconds. You can also use this to place orders for you without having to navigate away from TradingView to your exchange/brokerage site.
If you would like a better understanding of how to create an alert for automation, please visit the article this strategy is being published for.
When I copy and paste the above code, I get this error: root_data expression of plot_0 has invalid type: series__bool expected series;
I can't figure out how to plot a boolean. If I change the code to plot(close) or some other series that is not a bool, it works fine. Any ideas?
plot(g? 1: 0, "Buy", color=green)
plot(r? 1: 0, "Sell", color=red)
plot(b? 1: 0, "Both", color=black)
Kind regards :)