TradingView
RicardoSantos
13 Mei 2017 pukul 16.33

[RS]Support and Resistance V2 

Euro Fx/U.S. DollarFXCM

Huraian

added alternative source option

Nota Keluaran

Added markers to start of a level.

Nota Keluaran

Update for Version 4 pinescript.
Komen
nilanjan62
hi can you please describe how to ue it and whe to buy an where to ll because the blue support or resistance easily breaks down or up....very precise indicator but need to learn.....please help
Futuraman
Sweet. You continue to be a bright spot on TradingView.
MrMister88
@Futuraman, hey, how do you use it? sell on points above and buy on points below?, because sometimes there are more then one point, for buy/sell
bassimams
Timeldah
//@version=4
study(
title='[RS]Support and Resistance',
shorttitle='SR',
overlay=true
)

use_alt_series = input(defval=false, title='Use alternative source?')
alt_src = input(defval=close, title='Alternative source:')
h = use_alt_series ? alt_src : high
l = use_alt_series ? alt_src : low

window1 = input(defval=8, title='lookback window 1:', type=input.integer)
window2 = input(defval=21, title='lookback window 2:', type=input.integer)
percent_of_range_for_trade_zone = input(defval=25.0, title='Percent of the range to use for trade zone', type=input.float) * 0.01

short_term_top = valuewhen(h >= highest(h, window1), h, 0)
short_term_bot = valuewhen(l <= lowest(l, window1), l, 0)
long_term_top = valuewhen(h >= highest(h, window2), h, 0)
long_term_bot = valuewhen(l <= lowest(l, window2), l, 0)

short_term_resist = change(short_term_top) != 0 ? na : short_term_top
short_term_suport = change(short_term_bot) != 0 ? na : short_term_bot

long_term_resist = change(long_term_top) != 0 ? na : long_term_top
long_term_suport = change(long_term_bot) != 0 ? na : long_term_bot

long_term_resist_marker = change(fixnan(long_term_resist)) != 0 ? long_term_resist : na
long_term_suport_marker = change(fixnan(long_term_suport)) != 0 ? long_term_suport : na

short_term_resist_plot = plot(series=short_term_resist, title='STR', color=color.navy, linewidth=1, style=plot.style_linebr, transp=0)
short_term_suport_plot = plot(series=short_term_suport, title='STS', color=color.navy, linewidth=1, style=plot.style_linebr, transp=0)
long_term_resist_plot = plot(series=long_term_resist, title='LTR', color=color.blue, linewidth=4, style=plot.style_linebr, transp=70)
long_term_suport_plot = plot(series=long_term_suport, title='LTS', color=color.blue, linewidth=4, style=plot.style_linebr, transp=70)
long_term_resist_marker_plot = plot(series=long_term_resist_marker, title='.R', color=color.blue, linewidth=4, style=plot.style_circles, transp=0)
long_term_suport_marker_plot = plot(series=long_term_suport_marker, title='.S', color=color.blue, linewidth=4, style=plot.style_circles, transp=0)

fill(short_term_resist_plot, long_term_resist_plot, color=color.orange, transp=80, title="Resistance")
fill(short_term_suport_plot, long_term_suport_plot, color=color.olive, transp=80, title="Support")

// Calculate entry zone:
float short_term_resist_trade_limit = na
float short_term_suport_trade_limit = na

range = fixnan(short_term_resist) - fixnan(short_term_suport)

if not na(short_term_resist)
if not na(short_term_resist_trade_limit[1])
short_term_resist_trade_limit := short_term_resist_trade_limit[1]
else
short_term_resist_trade_limit := short_term_resist - range * percent_of_range_for_trade_zone

if not na(short_term_suport)
if not na(short_term_suport_trade_limit[1])
short_term_suport_trade_limit := short_term_suport_trade_limit[1]
else
short_term_suport_trade_limit := short_term_suport + range * percent_of_range_for_tr
Charts247TradingAcademy
Great work RS. I cant trade without your S&R lines. If you could do a MTF of this Indicator it will be awesome. thanks
TheYangGuizi
Would it be possible to add some sort of marker/barcolor/etc at the first candle where the support/resistance line starts? Really nice work btw.

at these spots:
RicardoSantos
@TheYangGuizi, shouldnt be a issue
TheYangGuizi
RicardoSantos
@TheYangGuizi, something like this?
Lebih