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

Allow MA defaults other than SMA #544

Closed
wants to merge 1 commit into from

Conversation

trufanov-nok
Copy link
Contributor

In fact, currently there is no MA indicators in TA-Lib which use optInMAType argument defaults other than SMA(0), but I would like to add a support for such indicators, bcs I was going to add one for myself.
I hardcoded "matype" bcs default_arg contains "mAType".

@@ -257,7 +257,10 @@ def cleanup(name):
else:
print('int %s=-2**31' % var, end=' ') # TA_INTEGER_DEFAULT
elif arg.startswith('TA_MAType'):
print('int %s=0' % var, end=' ') # TA_MAType_SMA
if 'matype' in defaults:
print('int %s=%s' % (var, defaults['matype']), end=' ')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make this a single line:

print('int %s=%s' % (var, defaults.get('matype', 0)), end=' ')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a python developer, so... Could you edit my PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you may create a new one from a scratch by yourself - I'll delete this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a second thougth ...

if 'matype' in defaults:
                    print('int %s=%s' % (var, defaults['matype']), end=' ')

is not equal to just print('int %s=0' % var, end=' '). Bcs it'll do nothing in case TA_MAType argument exists but have no any default value. Although I think there is no such cases in the sourcecode.

mrjbq7 added a commit that referenced this pull request Sep 13, 2022
@mrjbq7
Copy link
Collaborator

mrjbq7 commented Sep 13, 2022

Okay, I made a patch in dae5f6d.

Thanks!!

@mrjbq7 mrjbq7 closed this Sep 13, 2022
@trufanov-nok trufanov-nok deleted the patch branch September 13, 2022 15:24
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

Successfully merging this pull request may close these issues.

None yet

2 participants