Bar Color Long / Short Indicator With Advised SL

This script is a trading indicator named "Bar Color Long / Short Indicator With Advised SL" designed for the TradingView platform. The indicator's primary purpose is to provide entry signals for long and short positions, based on various technical analysis methods. Additionally, the indicator suggests stop-loss levels for both long and short positions.

User Inputs
The indicator has several user inputs, such as:

Show bar colors (ON/OFF)
When the bar colors are turned off, the alert signals for long and short positions will be displayed instead.

Custom Risk Calculation
The script calculates a custom risk level based on a modified version of the RSI (Relative Strength Index) formula. The custom risk level is divided into three categories: low, medium, and high.

Sentiment Score Calculation
The indicator calculates a sentiment score based on a combination of methods resembling EMA (Exponential Moving Average), MACD (Moving Average Convergence Divergence), and ROC (Rate of Change). The sentiment score is used to determine if the sentiment is positive or negative.

Bollinger Bands Percent and Combined Signal
The Bollinger Bands Percent is calculated, and the custom risk, sentiment score, and Bollinger Bands Percent are combined to generate a new signal. This signal is used in conjunction with EMA10 to determine the bar colors and provide entry signals.

Bar Colors
Based on the combined signal and EMA10, the script determines the bar colors as follows:

Orange: Positive sentiment
Blue: Negative sentiment
Gray: Neutral
Entry Signals and Alerts
When the bar colors are turned off, the indicator displays large green arrow signals for long (buy) positions and red arrow signals for short (sell) positions based on the sentiment and EMA10 conditions. The script also includes alert conditions for long and short signals, which can be used to set up notifications when these signals are triggered in the TradingView platform.

Advised Stop-Loss Levels
The indicator plots stop-loss lines for both long and short positions at the last candle, accompanied by labels showing the advised stop-loss levels in numeric values.


本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。