Open tan-yong-sheng opened 3 years ago
Thanks, @tys203831
Can you please provide a sample csv file that you were using for this?
Hello @tys203831
have you resolved this issue ? as I am facing a similar problem in my project. It would be very helpful if you can guide me thanks
Is there a way to fix this @ChillarAnand? Also it will be great if you can let us know why this issue is arising. So that we can avoid such cases for the timebeing
I am not able to reproduce the issue. @Prasanna28Devadiga
If someone can share sample data to reproduce this issue, it will be helpful.
@ChillarAnand Here is a sample data that i was facing the issue with: https://drive.google.com/file/d/1mt_T3wH2ICaqCG6UcR9kkyEWpH-hV9dB/view?usp=sharing It is the Intraday (1 minute) data for 'IDEA' stock downloaded from the yfinance api.
@ChillarAnand were you able to find out what exactly is going wrong/ ways to workaround ?
Hey guys, I think the issue is from the ATR function, called in the renko_DF function.
df2.brick_size = round(ATR(DF,120)[-1],0)
The reason for the NaNs is because of the ATR for the Malaysian ticker. Try the below
print(round(ATR(ohlc,120)[-1],0))
print(ATR(ohlc,120)[-1])
Output is 0, when rounded and 0.0594166616598765
So in the renko_DF function, just change df2.brick_size = round(ATR(DF,120)[-1],0)
to df2.brick_size = round(ATR(DF,120)[-1],1)
Which gives an ATR of 0.1 and the NaN doesnt appear anymore.
Alternately, just assign a df2.brick_size =
with a fixed value (to get the fixed brick size) and it will work.
Also note that you will get NaN's whenever a stock price < 1. I think by simply adding an if/else statement within the function to check if price is > 1 or < 1 and set the rounding to 0 or 1 will help resolve the issue. closes #18
@chranga Thanks for submitting detailed report.
Would you like to send pull request for the same?
@chranga Thanks for submitting detailed report.
Would you like to send pull request for the same?
Hi, a bit new to this. But I edited the above comment with closes #18 but it doesnt seem to work?
Below Renko works for AAPL stock tickers but not for Malaysia Exchange such as 0200.KL. It comes out ValueError:cannot convert float NaN to integer although I find no NaN on my OHLC stock price data.