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)
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
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 Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out