-
-
Notifications
You must be signed in to change notification settings - Fork 967
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
DonchianChannel problem #133
Comments
Hi @yomoko , Thank you for your advice. I will do some tests to check the results of the Donchian Channel asap. Best, |
@bukosabino |
I'm not sure I agree with your interpretation of the indicators for pt 1). The indicator you're suggesting is simply whether we see an N day high or low |
Hi @yomoko , I have worked on the DonchianChannel indicator. I have added some useful functions and fix some minor details. By answering your comments:
I have developed some test to check the results, and they match with this Google Sheet doc: https://docs.google.com/spreadsheets/d/17JWWsxSiAb24BLzncUpccc8hg-03QjVWVXmoRCJ2lME/edit#gid=0 Please, check it and let me know if there is something wrong.
indicator = ta.volatility.DonchianChannel(close=df['close'], n=20, fillna=False)
df['d_channel_high'] = indicator.donchian_channel_hband()
df['d_channel_low'] = indicator.donchian_channel_lband()
df['d_channel_middle'] = indicator.donchian_channel_mband()
df['d_channel_width'] = indicator.donchian_channel_wband()
df['d_channel_percentage'] = indicator.donchian_channel_pband()
df['d_channel_high_indicator'] = indicator.donchian_channel_hband_indicator()
df['d_channel_low_indicator'] = indicator.donchian_channel_lband_indicator() To use all of this, you need to update the last version (0.5.21) of the library: pip install -U ta or pip install ta==0.5.21 Best, |
@bukosabino |
Hi @yomoko , You are right, I should calc the highest high and the lowest low. Let me try a new proposal. Best, |
@bukosabino Because the max you get is close = hband(current close = current high) and the min close = lband(current close = current low) if current period is being used. But the definition is actually LAST n-period. A lot of charting programs out that are actually wrong. Eg. tradingview & metatrader |
I have fixed the indicator:
In your case, if you want the last n-periods, you should call the indicator: from ta.volatility.DonchianChannel
indicator = ta.volatility.DonchianChannel(high=df['high'], low=df['low'], close=df['close'], n=20, offset=1, fillna=False)
df['d_channel_high'] = indicator.donchian_channel_hband()
df['d_channel_low'] = indicator.donchian_channel_lband()
df['d_channel_middle'] = indicator.donchian_channel_mband()
df['d_channel_width'] = indicator.donchian_channel_wband()
df['d_channel_percentage'] = indicator.donchian_channel_pband() The results of the tests matches with these documents:
It is available in the last library version (0.5.22). pip install -U ta or pip install ta==0.5.22 Thank you for your help. Please, let me know if you see anything wrong! Best, |
@bukosabino |
Hi @yomoko , Could you provide me some link/information about the offset should be 0 or 1? Best, |
@bukosabino There's nothing wrong with your deleted channel band indicator, but since you have your previous point 1 wrong, that's what made the indicator doesn't make sense. I have said that numerous times already. And if you still don't get it, as I said in the previous reply, forget it. |
Hi, I think there's something wrong with the donchian channel method.
shift(1)
to make the date sync with the correct result.n=100
andfillna=False
, there's no na value (the first n values) in the resultta.volatility.DonchianChannel(high)
and lband,ta.volatility.DonchianChannel(low)
, which is two different operation. But in the documentation and they way how it's structured, it says to use'close'
column, which is very mis-leading and wrong.Why is that? Thanks.
The text was updated successfully, but these errors were encountered: