Advertisement
xmd79

RSI OBLIVION

Jan 12th, 2023
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. //@version=5
  2. indicator(' RSI OBLIVION ', overlay=false)
  3.  
  4. // Инициализация параметров
  5. src = input(title='Source', defval=close) // Устанавливаем тип цены для расчетов
  6. for_rsi = input(title='RSI_period', defval=14) // Период для RSI
  7. for_ma = input(title='Basis_BB', defval=50) // Период для MA внутри BB
  8. for_mult = input.int(title='Stdev', defval=2, minval=1, maxval=5) // Число стандартных отклонений для BB
  9. for_sigma = input.float(title='Dispersion', defval=0.1, minval=0.01, maxval=1) // Дисперсия вокруг MA
  10.  
  11. // Условия работы скрипта
  12. current_rsi = ta.rsi(src, for_rsi) // Текущее положение индикатора RSI
  13. basis = ta.ema(current_rsi, for_ma)
  14. dev = for_mult * ta.stdev(current_rsi, for_ma)
  15. upper = basis + dev
  16. lower = basis - dev
  17. disp_up = basis + (upper - lower) * for_sigma // Минимально-допустимый порог в области мувинга, который должен преодолеть RSI (сверху)
  18. disp_down = basis - (upper - lower) * for_sigma // Минимально-допустимый порог в области мувинга, который должен преодолеть RSI (снизу)
  19. color_rsi = current_rsi >= disp_up ? color.lime : current_rsi <= disp_down ? color.red : #ffea00 // Текущий цвет RSI, в зависимости от его местоположения внутри BB
  20.  
  21. // Дополнительные линии и заливка для областей для RSI
  22. h1 = hline(70, color=#d4d4d4, linestyle=hline.style_dotted, linewidth=1)
  23. h2 = hline(30, color=#d4d4d4, linestyle=hline.style_dotted, linewidth=1)
  24. fill(h1, h2, transp=95)
  25.  
  26. // Алерты и условия срабатывания
  27. rsi_Green = ta.crossover(current_rsi, disp_up)
  28. rsi_Red = ta.crossunder(current_rsi, disp_down)
  29.  
  30. alertcondition(condition=rsi_Green, title='RSI cross Above Dispersion Area', message='The RSI line closing crossed above the Dispersion area.')
  31.  
  32. alertcondition(condition=rsi_Red, title='RSI cross Under Dispersion Area', message='The RSI line closing crossed below the Dispersion area')
  33.  
  34. // Результаты и покраска
  35. plot(basis, color=color.new(color.white, 0))
  36. plot(upper, color=color.new(#00fff0, 0), linewidth=2)
  37. plot(lower, color=color.new(#00fff0, 0), linewidth=2)
  38. s1 = plot(disp_up, color=color.new(color.white, 0))
  39. s2 = plot(disp_down, color=color.new(color.white, 0))
  40. fill(s1, s2, color=color.new(color.white, 80))
  41. plot(current_rsi, color=color_rsi, linewidth=2)
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement