0% found this document useful (0 votes)
212 views2 pages

Support - Resistance + Fibonacci For Binary Options

This document is a TradingView Pine Script that creates an indicator for identifying support and resistance levels along with Fibonacci retracement levels for binary options trading. It calculates recent swing highs and lows, plots them, and dynamically detects support and resistance zones based on user-defined parameters. The script allows customization of Fibonacci levels and the visibility of support/resistance zones on the chart.

Uploaded by

swapon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
212 views2 pages

Support - Resistance + Fibonacci For Binary Options

This document is a TradingView Pine Script that creates an indicator for identifying support and resistance levels along with Fibonacci retracement levels for binary options trading. It calculates recent swing highs and lows, plots them, and dynamically detects support and resistance zones based on user-defined parameters. The script allows customization of Fibonacci levels and the visibility of support/resistance zones on the chart.

Uploaded by

swapon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=5

indicator("Support/Resistance + Fibonacci for Binary Options", overlay=true)

// Inputs
fibLevels = input(title="Fibonacci Levels", defval="23.6, 38.2, 50, 61.8, 78.6")
showSR = input(true, title="Show Support/Resistance Zones")
srLookback = input(50, title="S/R Lookback Period (Bars)")

// Calculate Recent Swing Highs & Lows


swingHigh = ta.swingshigh(high, 5)
swingLow = ta.swingslow(low, 5)

// Plot Swing Points


plotshape(swingHigh, style=shape.triangledown, color=color.red,
location=location.abovebar, size=size.small)
plotshape(swingLow, style=shape.triangleup, color=color.green,
location=location.belowbar, size=size.small)

// Auto-Detect Latest Swing High & Low


var float lastSwingHigh = na
var float lastSwingLow = na

if not na(swingHigh)
lastSwingHigh := high[ta.highestbars(high, 5)[0]]
if not na(swingLow)
lastSwingLow := low[ta.lowestbars(low, 5)[0]]

// Draw Fibonacci Retracement if swings detected


if not na(lastSwingHigh) and not na(lastSwingLow)
fibUp = lastSwingLow < lastSwingHigh
fibStart = fibUp ? lastSwingLow : lastSwingHigh
fibEnd = fibUp ? lastSwingHigh : lastSwingLow

// Calculate Fibonacci Levels


fibValues = str.split(fibLevels, ", ")
fibColors = color.new(color.purple, 70)

for level in fibValues


lvl = float(level) / 100
priceLevel = fibStart + (fibEnd - fibStart) * lvl
line.new(bar_index[10], priceLevel, bar_index, priceLevel, color=fibColors,
width=1, style=line.style_dashed)
label.new(bar_index, priceLevel, text=level + "%", color=color.white,
textcolor=color.black, style=label.style_label_center, size=size.small)

// Dynamic Support & Resistance Zones


var float[] supportLevels = array.new_float()
var float[] resistanceLevels = array.new_float()

// Detect S/R Levels


if barstate.islast
// Support (Recent Lows)
for i = 0 to srLookback by 1
if low[i] == ta.lowest(low, srLookback)[i]
array.push(supportLevels, low[i])

// Resistance (Recent Highs)


for i = 0 to srLookback by 1
if high[i] == ta.highest(high, srLookback)[i]
array.push(resistanceLevels, high[i])

// Plot S/R Zones


if showSR
for level in supportLevels
hline(level, "Support", color=color.green,
linestyle=hline.style_dashed, linewidth=1)
for level in resistanceLevels
hline(level, "Resistance", color=color.red,
linestyle=hline.style_dashed, linewidth=1)

You might also like