RicardoSantos

[RS]Adaptive Range Candles V0

EXPERIMENTAL:
similar to renko.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
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?
Reply
RicardoSantos PRO 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.
Reply
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
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