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
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.