Reputation: 1
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)
Upvotes: 0
Views: 7