OPEN-SOURCE SCRIPT
Fibonacci 61.8 BUY or SELL (EMA-Filtered)

This indicator helps identify Fibonacci-based Buy or Sell zones based on recent pivot highs/lows, but only when filtered by the EMA trend.
✅ Buy Zones: Only when price is above EMA
✅ Sell Zones: Only when price is below EMA
🟩 Draws a 61.8% Fibonacci retracement line
🟥 Adds a label with price value: BUY @ or SELL @
📏 All drawing is based on pivot structure (LL → LH for buy; HH → HL for sell)
📊 EMA Trend Filter
Only draws buy setups when price > EMA
Only draws sell setups when price < EMA
You can change the EMA length:
📈 How It Works – Step by Step
✅ BUY SETUP (LL → LH, only if price > EMA):
Detects pivot low → stores as prevLow
Detects pivot high after that → stores as prevHigh
Calculates Fib Level:
fibLevel = prevLow + (prevHigh - prevLow) * 0.618
Draws a green dashed line at that fib level
Adds a label to the right:
"BUY @ price"
🚫 SELL SETUP (HH → HL, only if price < EMA):
Detects pivot high → stores as prevHigh
Detects pivot low after that → stores as prevLow
Calculates Fib Level:
fibLevel = prevHigh - (prevHigh - prevLow) * 0.618
Draws a red dashed line at that fib level
Adds a label to the right:
"SELL @ price"
✅ Strengths
Simple yet powerful EMA + Fibonacci strategy
Visually clean: only one signal shown at a time
Customizable: style, color, width, offset, precision
Works well for trend continuation trades
⚠️ Limitations
Only shows latest setup, not historical signals
Does not show price breaking fib level or reacting to it
Assumes fixed 61.8% retracement—no multi-level analysis
Doesn't differentiate between minor and major pivots
📌 How to Trade It
🟢 BUY Example:
Price above EMA
Pivot Low → Pivot High → 61.8% level plotted
Wait for price to react at that level to go long
🔴 SELL Example:
Price below EMA
Pivot High → Pivot Low → 61.8% level plotted
Wait for price to react at that level to go short
✅ Buy Zones: Only when price is above EMA
✅ Sell Zones: Only when price is below EMA
🟩 Draws a 61.8% Fibonacci retracement line
🟥 Adds a label with price value: BUY @ or SELL @
📏 All drawing is based on pivot structure (LL → LH for buy; HH → HL for sell)
📊 EMA Trend Filter
Only draws buy setups when price > EMA
Only draws sell setups when price < EMA
You can change the EMA length:
📈 How It Works – Step by Step
✅ BUY SETUP (LL → LH, only if price > EMA):
Detects pivot low → stores as prevLow
Detects pivot high after that → stores as prevHigh
Calculates Fib Level:
fibLevel = prevLow + (prevHigh - prevLow) * 0.618
Draws a green dashed line at that fib level
Adds a label to the right:
"BUY @ price"
🚫 SELL SETUP (HH → HL, only if price < EMA):
Detects pivot high → stores as prevHigh
Detects pivot low after that → stores as prevLow
Calculates Fib Level:
fibLevel = prevHigh - (prevHigh - prevLow) * 0.618
Draws a red dashed line at that fib level
Adds a label to the right:
"SELL @ price"
✅ Strengths
Simple yet powerful EMA + Fibonacci strategy
Visually clean: only one signal shown at a time
Customizable: style, color, width, offset, precision
Works well for trend continuation trades
⚠️ Limitations
Only shows latest setup, not historical signals
Does not show price breaking fib level or reacting to it
Assumes fixed 61.8% retracement—no multi-level analysis
Doesn't differentiate between minor and major pivots
📌 How to Trade It
🟢 BUY Example:
Price above EMA
Pivot Low → Pivot High → 61.8% level plotted
Wait for price to react at that level to go long
🔴 SELL Example:
Price below EMA
Pivot High → Pivot Low → 61.8% level plotted
Wait for price to react at that level to go short
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。