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の精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。