[RS]Adaptive Range Candles V0

similar to renko.
Remove from Favorite Scripts Add to Favorite Scripts
study(title='[RS]Adaptive Range Candles V0', shorttitle='ARC', overlay=true)
multiplier = input(title='Range Multiplier:', type=float, defval=0.01)
SHOW_CLOSE_LINE = input(title='Show Close Line?', type=bool, defval=true)

h = na(h[1]) ? high : high >= h[1] ? high : h[1]
l = na(l[1]) ? low : low <= l[1] ? low : l[1]
range = (h-l)*multiplier

avg = na(avg[1]) ? close : close > avg[1] + range ? close : close < avg[1] - range ? close : avg[1]
pavg = change(avg) != 0 ? valuewhen(change(avg) != 0, avg, 1) : pavg[1]

plotcandle(pavg, high, low, avg, color=avg > pavg ? lime : red)
plot(title='C', series=SHOW_CLOSE_LINE?close:na, color=black, linewidth=1, transp=0)
Thanks Ricardo for sharing!!! Can multiple Candles in same Range be condensed into one Range Candle or Bar for filtering instead of multiple Range Candles so that Range Bar is only having variable Price not Time?
RicardoSantos sudhir.mehta
not possible in pinescript, as this is a overlay on top of already existing candles, for that it would need to be built in and replace the underlying candles.
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
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