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. اقرأ المزيد في شروط الاستخدام.