OPEN-SOURCE SCRIPT

Stoch RSI & RSI Buy/Sell Signals with MACD Trend Filter

Aktualisiert
This indicator combines multiple technical analysis tools and conditions to generate precise buy and sell signals. It utilizes the Stochastic RSI and RSI for overbought/oversold signals, a MACD trend filter, and candle color confirmation to avoid false signals. Key conditions include:

Buy Signal:
Conditions Met on Previous Candle:
  • Stochastic RSI (%K) is below the user-defined oversold level.
  • RSI is either below the neutral level or within the oversold range.
  • MACD line is in a bearish trend, confirmed by three consecutive downward bars.
  • Current Candle Requirement: Closes in green to confirm a buy.


Sell Signal:
Conditions Met on Previous Candle:
  • Stochastic RSI (%K) is above the user-defined overbought level.
  • RSI is either above the neutral level or within the overbought range.
  • MACD line is in a bullish trend, confirmed by three consecutive upward bars.
  • Current Candle Requirement: Closes in red to confirm a sell.


This indicator also includes custom color settings based on RSI levels and can be toggled to display buy/sell signals visually on the chart.
-------
DONATIONS:
USDT: 0x678d7ca85574f35c4ad7c673c92cd3f4795f98d9 (ERC20)
Versionshinweise
// Track previous RSI value
var float previousRsiValue = na

// Update flags if conditions are met
if (buyConditionMet)
buyFlag := true
previousRsiValue := rsi // Store the RSI value for the label

if (sellConditionMet)
sellFlag := true
previousRsiValue := rsi // Store the RSI value for the label

// Determine colors for buy/sell signals based on RSI level
buyColor = (previousRsiValue < 35) ? buyColorGreen : buyColorBlue // Use user-defined green if RSI <= 35, else blue
sellColor = (previousRsiValue > 65) ? sellColorRed : sellColorOrange // Use user-defined red if RSI >= 70, else orange

// Signals with flag and candle color checks
buySignal = buyFlag and close > open
sellSignal = sellFlag and close < open

// Reset flags after signals are triggered
if (buySignal)
buyFlag := false
if (sellSignal)
sellFlag := false

// Alerts
alertcondition(buySignal, title="Buy Alert", message="Buy signal generated!")
alertcondition(sellSignal, title="Sell Alert", message="Sell signal generated!")

// User input to toggle buy/sell signals visibility
showSignals = input(true, title="Show Buy/Sell Signals")

// Plotting buy/sell signals based on user input with previous RSI value in the text
if (showSignals and buySignal)
label.new(bar_index, low, "BUY (" + str.tostring(math.floor(previousRsiValue)) + ")", color=buyColor, style=label.style_label_up, textcolor=color.white, size=size.small)

if (showSignals and sellSignal)
label.new(bar_index, high, "SELL (" + str.tostring(math.floor(previousRsiValue)) + ")", color=sellColor, style=label.style_label_down, textcolor=color.white, size=size.small)
Versionshinweise
- Fixed some issues related to the color of the signals.
Versionshinweise
- In this update, all conditions were added to the settings so each one of them can be enabled/disabled
buysellsignalforecastingRelative Strength Index (RSI)Stochastic RSI (STOCH RSI)strategiestrategy

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss