OPEN-SOURCE SCRIPT
Stop loss

Hi all!
This simple indicator will alert you when a price limit is reached (stop loss). I've created this indicator out of 2 reasons:
1. My broker only lets me to set a stop loss limit until a certain time. The time is a couple of months forward in time, but with a Tradingview plan that lets you set open-ended alerts this can alert you later than that.
2. I would like a stop loss on closing price only. This will not get you stopped out by a wick, but needing a 'close' price to be equal or below (for long trades) or equal or above (for short trades).
So this indicator will alert you when your stop to is hit and exit with a 'runtime.error' on the tick after the alert. It won't give you any good looking visuals, just a red line of your chosen stop loss price. Set it in the settings or click '...'->'Reset points...' and drag the line to your desired limit price. Also choose if your trade direction is long or short and if the bar that enters below/above your stop loss needs to be closed.
Note that there's a limitation depending on your style of trading (short term or long term) and if your Tradingview subscription provides live data or not. Also this will only alert you, not buy (for short trades) or sell (for long trades) your contracts when the stop loss is hit.
Best of trading luck!
This simple indicator will alert you when a price limit is reached (stop loss). I've created this indicator out of 2 reasons:
1. My broker only lets me to set a stop loss limit until a certain time. The time is a couple of months forward in time, but with a Tradingview plan that lets you set open-ended alerts this can alert you later than that.
2. I would like a stop loss on closing price only. This will not get you stopped out by a wick, but needing a 'close' price to be equal or below (for long trades) or equal or above (for short trades).
So this indicator will alert you when your stop to is hit and exit with a 'runtime.error' on the tick after the alert. It won't give you any good looking visuals, just a red line of your chosen stop loss price. Set it in the settings or click '...'->'Reset points...' and drag the line to your desired limit price. Also choose if your trade direction is long or short and if the bar that enters below/above your stop loss needs to be closed.
Note that there's a limitation depending on your style of trading (short term or long term) and if your Tradingview subscription provides live data or not. Also this will only alert you, not buy (for short trades) or sell (for long trades) your contracts when the stop loss is hit.
Best of trading luck!
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。