RicardoSantos

[RS]Gap SR Zones V0

EXPERIMENTAL:
Request for MarxBabu.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Gap SR Zones V0', shorttitle='Gap', overlay=true)
bars = input(20)

is_gap_up = open > close[1] + syminfo.mintick
is_gap_down = open < close[1] - syminfo.mintick
bars_since_gap_up = barssince(is_gap_up)
bars_since_gap_down = barssince(is_gap_down)

gap_up_open = is_gap_up ? open : bars_since_gap_up > bars ? na : gap_up_open[1]
gap_up_high = is_gap_up ? highest(2) : bars_since_gap_up > bars ? na : gap_up_high[1]
gap_up_low = is_gap_up ? lowest(2) : bars_since_gap_up > bars ? na : gap_up_low[1]

gap_down_open = is_gap_down ? open : bars_since_gap_down > bars ? na : gap_down_open[1]
gap_down_high = is_gap_down ? highest(2) : bars_since_gap_down > bars ? na : gap_down_high[1]
gap_down_low = is_gap_down ? lowest(2) : bars_since_gap_down > bars ? na : gap_down_low[1]

plot(title='Up Open', series=gap_up_open, style=linebr, color=black, linewidth=2)
up_1 = plot(title='Up High', series=gap_up_high, style=linebr, color=black, linewidth=1)
up_2 = plot(title='Up Low', series=gap_up_low, style=linebr, color=black, linewidth=1)
fill(up_1, up_2, color=red, transp=75)

plot(title='Down Open', series=gap_down_open, style=linebr, color=black, linewidth=2)
down_1 = plot(title='Down High', series=gap_down_high, style=linebr, color=black, linewidth=1)
down_2 = plot(title='Down Low', series=gap_down_low, style=linebr, color=black, linewidth=1)
fill(down_1, down_2, color=lime, transp=75)
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体中文
繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out