TulipCharts / tulipy

[NOT ACTIVELY MAINTAINED] Tulipy - Financial Technical Analysis Indicator Library (Python bindings for Tulip Charts)
https://github.com/TulipCharts/tulipindicators
GNU Lesser General Public License v3.0
330 stars 83 forks source link

Please help with examples as go-bys #39

Closed dreamerx88 closed 4 years ago

dreamerx88 commented 4 years ago

Please help newcomers with examples on how to call indicators and specific outputs when the indicators have multiple output arrays. Would very much appreciate examples with macd, stoch and crossover indicators. Thanks!

ps. have been able to duplicate usage example in https://tulipindicators.org/usage however it doesn't go through how to manipulate output arrays of BB...for example taking action on output array of BB High with the crossover indicator..not sure how to do that..

codeplea commented 4 years ago

Do you want to post what you've tried so far?

dreamerx88 commented 4 years ago

Sure. I went through line by line in the usage example provided and got the same output shown. Then I tried calling macd, it worked, same with macd[-1] but the output arrays of macd show all three output arrays - I dont know how to grab a specific output array, such as the macd line or the macd_signal and use with the crossover indicator -- need help on how to identify and pass the arrays to the crossover indicator. Here are the lines I added to the usage example:

DATA3 = np.array([100.65, 102.21, 103.54, ....]) macd = (ti.macd(DATA3, 12, 26, 9)) print(macd, macd[-1])

and the output of macd shows the three output arrays macd, macd_signal and macd_histogram

cirla commented 4 years ago

From the README:

Single outputs are returned directly. Indicators returning multiple outputs use a tuple in the order indicated by the outputs property.

You could put them in a dictionary if you wanted to refer to them by name, e.g.:

results = dict(zip(ti.macd.outputs, ti.macd(DATA3, 12, 26, 9)))
print(results["macd_signal"])
cirla commented 4 years ago

Closing in favor of #40, please request anything else you'd like to see in the documentation there.