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
9 months ago
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
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out