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

tz_localize=True fails to localize datetimes in tlines and alines specifications (and in the future also in xlim specification?) #314

Open
ventek opened this issue Jan 12, 2021 · 4 comments
Labels
bug Something isn't working question Further information is requested

Comments

@ventek
Copy link

ventek commented Jan 12, 2021

Hi, I tried to implement the tlines using mplfinance, and generate the trendline data as per the example, however, I still get this error:

ValueError:
tlines date pair (2021-01-11 09:35:00-05:00,2021-01-11 10:20:00-05:00) too close, or wrong order, or out of range!
df date range: [2021-01-11 09:35:00+00:00 , 2021-01-11 10:20:00+00:00]

Please, if anyone can advise, It will be much appreciated.

Regards.

@ventek ventek added the question Further information is requested label Jan 12, 2021
@DanielGoldfarb
Copy link
Collaborator

I'm guessing the problem is that you have different timezone information in your tlines datetimes compared with your DataFrame DatetimeIndex, and so it thinks that the times you specified with tlines are outside of the range of the DatetimeIndex in your DataFrame.

If the above is not enough information to solve your problem, then please post your data (csv file), and your code, so that I can try to reproduce this.

All the best. --Daniel

@ventek
Copy link
Author

ventek commented Jan 12, 2021

Hi Daniel, Thanx for the quick response, I have sent an email with the csv and code.

@DanielGoldfarb
Copy link
Collaborator

Hi Daniel, Thanx for the quick response, I have sent an email with the csv and code.

Got it. I will try to make time to look into this today. I suspect that it may have something to do with the fix for this timezone bug.

In the meantime, until I get a chance to look at this, please try adding kwarg tz_localize=False to your call to mpf.plolt() and let me know if that fixes the problem. Thanks.

@ventek
Copy link
Author

ventek commented Jan 12, 2021

Hi Daniel, Adding tz_localize=False solved the problem.

Thank you so much for the assistance.

@ventek ventek closed this as completed Jan 12, 2021
@DanielGoldfarb DanielGoldfarb added the bug Something isn't working label Jan 12, 2021
@DanielGoldfarb DanielGoldfarb changed the title Value Error When Using tline tz_localize=True fails to localize datetimes in tlines and alines specifications (and in the future also in xlim specification?) Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants