admin管理员组文章数量:1390880
I’m making a volume indicator in TakeProfit's Indie and I want to color the volume bars based on different thresholds.
For example:
≥ 200,000 → Red
≥ 100,000 → Light Blue
≥ 50,000 → Dark Blue
< 50,000 → Gray (default)
I tried using plot.Histogram() but I got an error about missing arguments.
# indie:lang_version = 5
from indie import indicator, color, plot
@indicator('Colored Volume Bars', overlay_main_pane=False)
@plot.histogram('Volume')
def Main(self):
vol = self.volume[0]
vol_color = color.GRAY(0.5) # Default color to ensure initialization
if vol >= 200000:
vol_color = color.RED
elif vol >= 100000:
vol_color = color.BLUE(0.5) # Light blue
elif vol >= 50000:
vol_color = color.BLUE # Dark blue
return vol, plot.Histogram(color=vol_color)
Error: 17:16 could not find function definition that matches indie.plot.Histogram call, reason: required arg value is not provided for param value
How do I color code a volume histogram in Indie?
UPD: find solution
return plot.Histogram(value=vol, color=vol_color)
本文标签: financeHow to color code volume bars based on thresholdsStack Overflow
版权声明:本文标题:finance - How to color code volume bars based on thresholds? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744752402a2623257.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论