Here's how the indicator works and how to use it:
The indicator provides a dropdown menu to choose the type of strategy. The available options are "Pullback" and "Simple."
The Supertrend indicator is used to identify the trend direction.
The indicator takes two input parameters:
ATR Length: Specifies the length of the Average True Range (ATR) used in the Supertrend calculation. The default value is 10.
Factor: Specifies the factor used in the Supertrend calculation. The default value is 3.0.
The indicator also includes an Exponential Moving Average (EMA) condition.
You can enable or disable the EMA condition using the "Ema Condition On/Off" checkbox.
If enabled, the indicator calculates an EMA based on the close price.
You can specify the length of the EMA using the "Ema Length" input parameter. The default value is 200.
The Relative Strength Index (RSI) indicator is used to generate additional conditions.
You can enable or disable the RSI condition using the "Rsi Condition On/Off" checkbox.
If enabled, the indicator calculates the RSI based on the close price.
You can specify the length of the RSI using the "Rsi Length" input parameter. The default value is 14.
Additionally, you can set the overbought and oversold levels for the RSI using the "RSI BUY Level" and "RSI SELL Level" input parameters, respectively. The default value for both is 50.
The indicator combines the Supertrend, EMA, and RSI conditions to generate buy and sell signals.
The specific conditions depend on the chosen strategy:
For the "Simple" strategy, the buy condition is when the Supertrend is in an up trend, not in a previous long position, the RSI is above the overbought level, and the close price is above the EMA.
For the "Pullback" strategy, the buy condition is when there is a cross under of the previous low with the Supertrend, the Supertrend is in an up trend, the RSI is above the overbought level, and the close price is above the EMA.
The sell conditions are the opposite of the respective buy conditions.
You can specify the start and end dates for the backtesting using the "Start calculations from" and "End calculations" inputs, respectively. The default start date is "2005-01-01" and the default end date is "2045-03-01." (this is work in progress) Still working on the table part, it is a bit tricky.
You can choose the trade direction using the "Trade Direction" input parameter. The available options are "Long," "Short," and "Both."
Depending on the selected trade direction, the indicator will generate signals accordingly.
The indicator plots the Supertrend line on the price chart.
Buy signals are shown as green labels below the price bars.
Sell signals are shown as red labels above the price bars.
Adjust the input parameters according to your preferences, and then apply the indicator to a chart to see the generated signals. Please note that this indicator should be used for educational purposes only and should be thoroughly tested before using it for real trading.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.