Custom indicator ?
henzycuong1 opened this issue · 2 comments
Hi, Do you have any example to create a new indicator with talipp template ?
Hi @henzycuong1 , there is no documentation as such but there are a plenty of examples of existing indicators. I am aware that it may not be very helpful since there are some implementation gotchas but if you describe what you are trying to achieve I will be happy to help.
Hi @henzycuong1 , there is no documentation as such but there are a plenty of examples of existing indicators. I am aware that it may not be very helpful since there are some implementation gotchas but if you describe what you are trying to achieve I will be happy to help.
I want to make candle indicator like the way I make on talib
Example I made in my backtest program:
def is_engulf(open, high, low, close):
result = np.array([])
for index in range(len(open)):
open_slice = open[: index + 1]
close_slice = close[: index + 1]
high_slice = high[: index + 1]
low_slice = low[: index + 1]
if (
len(open_slice) > 1
and is_red_bar(
open=open_slice[-2],
high=high_slice[-2],
low=low_slice[-2],
close=close_slice[-2],
)
and is_blue_bar(
open=open_slice[-1],
high=high_slice[-1],
low=low_slice[-1],
close=close_slice[-1],
)
and close_slice[-1] > high_slice[-2]
and open_slice[-1] >= low_slice[-2]
):
result = np.append(result, 100)
else:
result = np.append(result, 0)
return result
it's returned a numpy array and I can plot it