Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Step 1: Create the EMA Crossover Indicator (Main Chart)
- This script will plot the EMA crossover directly on the main price chart.
- //@version=5
- indicator("Dax EMA Crossing", overlay=true)
- // Dax EMA Cross Indicator
- emaShort = ta.ema(close, 12)
- emaLong = ta.ema(close, 26)
- // Highlight the background based on EMA crossover
- bgcolor(emaShort > emaLong ? color.new(color.green, 95) : color.new(color.red, 95))
- // Plot the EMA lines on the main chart
- plot(emaShort, color=color.blue, linewidth=2, title="12 EMA")
- plot(emaLong, color=color.orange, linewidth=2, title="26 EMA")
- Step 2: Create a Separate Script for RSI + BB EMA (Separate Panel)
- This script will plot the RSI and Bollinger Bands in a separate panel below the main chart.
- //@version=5
- indicator("RSI + BB EMA", overlay=false)
- // RSI + BB EMA Indicator (Separate Panel)
- rsi = ta.rsi(close, 12)
- basisBB = ta.ema(rsi, 21)
- stdev = ta.stdev(rsi, 21)
- upperBB = basisBB + stdev * 3
- lowerBB = basisBB - stdev * 3
- dispUp = basisBB + (upperBB - lowerBB) * 0.1
- dispDown = basisBB - (upperBB - lowerBB) * 0.1
- // Plot RSI and Bollinger Bands in a separate panel
- plot(rsi, color=color.purple, title="RSI (12)")
- plot(basisBB, color=color.orange, title="BB Basis (21)")
- plot(upperBB, color=color.red, title="Upper BB")
- plot(lowerBB, color=color.green, title="Lower BB")
- // Add horizontal lines for overbought and oversold levels
- hline(70, "Overbought", color=color.red, linestyle=hline.style_dashed, linewidth=1)
- hline(30, "Oversold", color=color.green, linestyle=hline.style_dashed, linewidth=1)
- // Background for overbought/oversold based on RSI + BB
- bgcolor(rsi >= dispUp ? color.new(color.red, 95) : rsi <= dispDown ? color.new(color.green, 95) : na)
- How to Implement:
- 1. Add the EMA Crossover Indicator:
- - Copy the first script into TradingView’s Pine Editor.
- - Save and apply it to your chart. This indicator will plot the EMA crossover directly on the main price chart.
- 2. Add the RSI + BB EMA Indicator:
- - Copy the second script into a new Pine Editor script.
- - Save and apply it to your chart. This will plot the RSI + BB EMA in a separate panel below the main price chart.
- Outcome:
- - The EMA crossover lines and background coloring will now appear on your main price chart.
- - 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
-
- 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