OPEN-SOURCE SCRIPT

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

Обновлено
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)
Информация о релизе
// 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)
Информация о релизе
- Fixed some issues related to the color of the signals.
Информация о релизе
- 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

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности