TradingView
Patternsmart
25 Okt 2016 pukul 14.12

Swing high low support & resistance 

U.S. Dollar/Canadian DollarFXCM

Deskripsi

The Swing indicator will plot dot lines that represent the swing points based on the swing length input(number of bars to the left and right of the swing point).

Swing highs and lows can be used by traders to identify possible areas of support and resistance, which can then be used to determine optimal positions for stop-loss or profit target orders. If an indicator fails to create a new swing high while the price of the security does reach a new high, there is a divergence between price and indicator, which could be a signal that the trend is reversing.

Swing highs and swing lows are earlier market turning points. Hence, they are natural choices for projecting support and resistance levels. Every swing point is a potential support or resistance level. However, for effective trading, focus on major swing highs and lows.

Catatan Rilis

Update the title of plot, it's easier to set custom alert now.

Catatan Rilis

Minor update

Catatan Rilis

Upgrade to Ver 4.

Catatan Rilis

Add 2 new inputs as the source date of Swing high and low.
Now we can use open/high/low/close/hl2/hlc3/ohlc4/hlcc4 to get Swing high and low.
Komentar
ora89
Hi there, thank you for sharing this. I would like to ask, what would you think is the best Swing Length value when day trading support and resistance? I'm looking at 15m or 30m charts.

Looking forward to hearing back from you.
Best.
ghattas360
@ora89, 50 on 30 min
Mandar_G
@ora89, 15
beavis
//@version=2
study("Core Pivot",shorttitle="CPIVOT", overlay=true)

leftBars = input(6)
rightBars = input(6)

running_ph = running_ph[1]
running_pl = running_pl[1]

ph = pivothigh(leftBars, rightBars)
pl = pivotlow( leftBars, rightBars)

if (ph)
running_ph := ph

if (pl)
running_pl := pl

plot(running_ph, style=cross, linewidth=1, color= blue, offset=-rightBars)
plot(running_ph, style=cross, linewidth=1, color= blue, offset=0)
plot(running_pl, style=cross, linewidth=1, color= red, offset=-rightBars)
plot(running_pl, style=cross, linewidth=1, color= red, offset=0)
Cashtagpat
@beavis, how do i get this to work? Please when i copy and paste the code in pine it gives bunch of errors:( need this badly to enable alerts. Will tip btc for working script that i can set alerts on.
djmad
@Cashtagpat,

not forget the tabulators line below the if conditions

//@version=5
indicator("Core Pivot",shorttitle="CPIVOT", overlay=true)

leftBars = input(6)
rightBars = input(6)

var float running_ph = na
var float running_pl = na

running_ph := running_ph
running_pl := running_pl

ph = ta.pivothigh(leftBars, rightBars)
pl = ta.pivotlow(leftBars, rightBars)

if (ph)
running_ph := ph

if (pl)
running_pl := pl

plot(running_ph, style=plot.style_cross, linewidth=1, color= color.blue, offset=-rightBars)
plot(running_ph, style=plot.style_cross, linewidth=1, color= color.blue, offset=0)
plot(running_pl, style=plot.style_cross, linewidth=1, color= color.red, offset=-rightBars)
plot(running_pl, style=plot.style_cross, linewidth=1, color= color.red, offset=0)
MR_IRVINGSANTIAGO-TRADERSCLUB
@djmad, thank you so much
RealDOGE2022
@MR_IRVINGSANTIAGO-TRADERSCLUB,running_pl := pl do not work
RNavega
@RealDOGE2022, try this shorter version:

// @version=5
indicator("Core Pivot",shorttitle="CPIVOT", overlay=true)

leftBars = input.int(6, "Left Bars", minval=1)
rightBars = input.int(6, "Right Bars", minval=1)

ph = fixnan(ta.pivothigh(leftBars, rightBars))
pl = fixnan(ta.pivotlow(leftBars, rightBars))

plot(ph, style=plot.style_cross, linewidth=1, color= color.blue, offset=-rightBars)
plot(ph, style=plot.style_cross, linewidth=1, color= color.blue, offset=0)
plot(pl, style=plot.style_cross, linewidth=1, color= color.red, offset=-rightBars)
plot(pl, style=plot.style_cross, linewidth=1, color= color.red, offset=0)
aljustun
@RNavega, can you combine 3 indicators into 1 indicator?
Lebih lanjut