Advertisement
Guest User

RSI + BB EMA and DAX EMA Crossing Strategy

a guest
Aug 15th, 2024
270
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | Cryptocurrency | 0 0
  1. Step 1: Create the EMA Crossover Indicator (Main Chart)
  2.  
  3. This script will plot the EMA crossover directly on the main price chart.
  4.  
  5. //@version=5
  6. indicator("Dax EMA Crossing", overlay=true)
  7.  
  8. // Dax EMA Cross Indicator
  9. emaShort = ta.ema(close, 12)
  10. emaLong = ta.ema(close, 26)
  11.  
  12. // Highlight the background based on EMA crossover
  13. bgcolor(emaShort > emaLong ? color.new(color.green, 95) : color.new(color.red, 95))
  14.  
  15. // Plot the EMA lines on the main chart
  16. plot(emaShort, color=color.blue, linewidth=2, title="12 EMA")
  17. plot(emaLong, color=color.orange, linewidth=2, title="26 EMA")
  18.  
  19.  
  20. Step 2: Create a Separate Script for RSI + BB EMA (Separate Panel)
  21.  
  22. This script will plot the RSI and Bollinger Bands in a separate panel below the main chart.
  23.  
  24.  
  25. //@version=5
  26. indicator("RSI + BB EMA", overlay=false)
  27.  
  28. // RSI + BB EMA Indicator (Separate Panel)
  29. rsi = ta.rsi(close, 12)
  30. basisBB = ta.ema(rsi, 21)
  31. stdev = ta.stdev(rsi, 21)
  32. upperBB = basisBB + stdev * 3
  33. lowerBB = basisBB - stdev * 3
  34. dispUp = basisBB + (upperBB - lowerBB) * 0.1
  35. dispDown = basisBB - (upperBB - lowerBB) * 0.1
  36.  
  37. // Plot RSI and Bollinger Bands in a separate panel
  38. plot(rsi, color=color.purple, title="RSI (12)")
  39. plot(basisBB, color=color.orange, title="BB Basis (21)")
  40. plot(upperBB, color=color.red, title="Upper BB")
  41. plot(lowerBB, color=color.green, title="Lower BB")
  42.  
  43. // Add horizontal lines for overbought and oversold levels
  44. hline(70, "Overbought", color=color.red, linestyle=hline.style_dashed, linewidth=1)
  45. hline(30, "Oversold", color=color.green, linestyle=hline.style_dashed, linewidth=1)
  46.  
  47. // Background for overbought/oversold based on RSI + BB
  48. bgcolor(rsi >= dispUp ? color.new(color.red, 95) : rsi <= dispDown ? color.new(color.green, 95) : na)
  49.  
  50. How to Implement:
  51.  
  52. 1. Add the EMA Crossover Indicator:
  53. - Copy the first script into TradingView’s Pine Editor.
  54. - Save and apply it to your chart. This indicator will plot the EMA crossover directly on the main price chart.
  55.  
  56. 2. Add the RSI + BB EMA Indicator:
  57. - Copy the second script into a new Pine Editor script.
  58. - Save and apply it to your chart. This will plot the RSI + BB EMA in a separate panel below the main price chart.
  59.  
  60. Outcome:
  61. - The EMA crossover lines and background coloring will now appear on your main price chart.
  62. - The RSI + BB EMA will plot in a separate panel below the main price chart, giving you a clear and organized view of both indicators.
Advertisement
Comments
  • tradingviewcodes
    267 days
    # text 0.12 KB | 0 0
    1. download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator
Add Comment
Please, Sign In to add comment
Advertisement