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
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.