Hi, Im trying to make a subclass of the TradeBar class, so that I can give the new class custom attributes.

What thing I'm trying to accomplish is to be able to check if a bar is bullish or bearish. And I realise that I can simply write something like this:

...
bar = ...
if bar.Close > bar.Open:
	bar.isBull = True
	bar.isBear = False
if bar.Close < bar.Open:
	bar.isBull = False
	bar.isBear = True

But I would really like to make a class called current bar and give it the attributes “isBear” and “isBull”.

Say i want to create a class called SignalBar as a subclass of TradeBar, or inheriting the TradeBar class. I would do it like this:

class SignalBar(TradeBar):
	def __init__(????):
		super().__init__(????)
		if SignalBar.Close < SignalBar.Open:
			SignalBar.isBear = True
		elif SignalBar.Close > Signal.Open:
			SignalBar.isBull =True
		else:
			SignalBar.isBull = False
			SignalBar.isBear = False

Or something like that. What my problem is that everywhere I search, people seem to define the __init__ method with specific arguments.

But since I don't know where to find the original TradeBar class, I do not know what to write in the __init__ .

Would it be possible to write it like so:

class SignalBar (TradeBar):
	def __init__(TradeBar):
		...

I know this is a bunch of newbie questions. However, being able to ask questions directly to quantconnect-users, really gives much more insight and understanding than taking a course online or reading all of stackoverflow haha. At least thats what I've found.

Thanks for your time and help,

Bertram