Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please help with examples as go-bys #39

Closed
dreamerx88 opened this issue Nov 25, 2019 · 4 comments
Closed

Please help with examples as go-bys #39

dreamerx88 opened this issue Nov 25, 2019 · 4 comments

Comments

@dreamerx88
Copy link

dreamerx88 commented Nov 25, 2019

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
Copy link
Member

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

@dreamerx88
Copy link
Author

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
Copy link
Collaborator

cirla commented Dec 1, 2019

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
Copy link
Collaborator

cirla commented Dec 1, 2019

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

@cirla cirla closed this as completed Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants