-
Notifications
You must be signed in to change notification settings - Fork 60
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
After the upgrade to 2.2.1 I can only initialize indicators RSI and TSI but cannot add a new input using rsi().add() and tsi().add(). #134
Comments
Hi @hysech , Also when pasting a code, please enclose it between triple backticks to render it properly, otherwise it is not very readable. |
Hi Nardew,
sorry for my delay. I am too old and too slow. I tried to prepare testing
data in more readable form as far as my not advanced lknowledge of Python
allowed, see appended files.
At my first glance at the data I thought that the root may be in my using
of global variables.
So I added testing local variables as well and corrected some mistakes in
my source. The local variables now have the same behavior as global ones.
From this I assume, the mistake is on my side, I do not understand how to
use the RSI, TSI classes in a new version of TALIPP properly. In my case I
would like to calculate rsi, tsi values for 3 different lengths of data
bars like 10 sec, 1min, 10min at the same program.
May I ask you to show me simple example how to use 3 different calls of RSI
class that keep relation to their own data source?
I tried to use same code which was working for previous talipp version and
now for new version I am dependent on "input values" function that I have
to repeat for last 200 bars after each new data bar.
In fact your library is pretty fast and I am able to reach needed speed of
the run. But I feel like a fool to make such technical nonse just for my
poor knowledge of the object oriented python.
Thank you in advance for your response and help,
Hynek
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Neobsahuje
žádné viry.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-3670896732873681728_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
st 1. 5. 2024 v 22:28 odesílatel nardew ***@***.***> napsal:
… Hi,
it's difficult to judge what is going wrong in your script. What is in
gl.rsi1l and gl.b1l_bar at the line where it fails? Can you print those
values in the line right before it?
Also when pasting a code, please enclose it between triple backticks to
render it properly, otherwise it is not very readable.
—
Reply to this email directly, view it on GitHub
<#134 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQITNIOJFFXXMFXF5SZUB3LZAFF73AVCNFSM6AAAAABG662V66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBZGA4DCNRXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
---------- Forwarded message ---------
Od: Hynek Sechovsky senior ***@***.***>
Date: út 14. 5. 2024 v 18:34
Subject: Re: [nardew/talipp]* Sorry Nardew, my poor knowledge* - After the
upgrade to 2.2.1 I can only initialize indicators RSI and TSI but cannot
add a new input using rsi().add() and tsi().add(). (Issue #134)
To: nardew/talipp <
***@***.***>
Hi Nardew,
sorry for my delay. I am too old and too slow. I tried to prepare testing
data in more readable form as far as my not advanced lknowledge of Python
allowed, see appended files.
*At my first glance at the data I thought that the root may be in my using
of global variables.*
*So I added testing local variables as well and corrected some mistakes in
my source. The local variables now have the same behavior as global ones.*
*From this I assume, the mistake is on my side, I do not understand how to
use the RSI, TSI classes in a new version of TALIPP properly*. In my case I
would like to calculate rsi, tsi values for 3 different lengths of data
bars like 10 sec, 1min, 10min at the same program.
May I ask you to show me simple example how to use 3 different calls of RSI
class that keep relation to their own data source?
I tried to use same code which was working for previous talipp version and
now for new version I am dependent on "input values" function that I have
to repeat for last 200 bars after each new data bar.
In fact your library is pretty fast and I am able to reach needed speed of
the run. But I feel like a fool to make such technical nonse just for my
poor knowledge of the object oriented python.
Thank you in advance for your response and help,
Hynek
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Neobsahuje
žádné viry.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-3019286199351059079_m_-3670896732873681728_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
st 1. 5. 2024 v 22:28 odesílatel nardew ***@***.***> napsal:
… Hi,
it's difficult to judge what is going wrong in your script. What is in
gl.rsi1l and gl.b1l_bar at the line where it fails? Can you print those
values in the line right before it?
Also when pasting a code, please enclose it between triple backticks to
render it properly, otherwise it is not very readable.
—
Reply to this email directly, view it on GitHub
<#134 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQITNIOJFFXXMFXF5SZUB3LZAFF73AVCNFSM6AAAAABG662V66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBZGA4DCNRXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi @hysech , instantiating three independent RSI indicators should not be problematic in any way: close = random.sample(range(1, 10000), 1000)
rsi1 = RSI(2, input_values=close)
rsi2 = RSI(3, input_values=close)
rsi3 = RSI(4, input_values=close)
print(rsi1[-1])
print(rsi2[-1])
print(rsi3[-1]) Output:
Some logging output I asked for above could help. |
Hello Nardew,
sorry to disturb you. I used your older version of talipp at the same code without any issue. After the upgrade to 2.2.1 I can only initialize indicators RSI and TSI but cannot add a new input using rsi().add() and tsi().add().
Maybe the reason is in my using global variables gl.rsi, gl. tsi or other trik in Python, but I am stalling 2 weeks already. To go on in debugging I have to initialize rsi, tsi repeatedly and after a limit use
.purge_oldest which for some reason is working!?!? Of course repeating the initializations is very time consuming and downgrading to older version is the last step?
I tried to add type(R/TSI) to the declaration of the global var. but it did not help.
My config file with globals:
from talipp.indicators import TSI, RSI, EMA, SMA, Stoch
tsi1l = type(TSI) # TSI(13, 25, input_values = close_1ll)
#tsi1l.add() = TSI(13, 25, input_values = close_1ll).add()
rsi1l = type(RSI) # RSI(14, input_values = close_1ll)
#rsi1l.add() = RSI(14, input_values = close_1ll).add()
tsi2l = type(TSI) # TSI(13, 25, input_values = close_1ll)
rsi2l = type(RSI) # RSI(14, input_values = close_1ll)
tsi3l = type(TSI) # TSI(13, 25, input_values = close_1ll)
rsi3l = type(RSI) # RSI(14, input_values = close_1ll)
Code using talipp is of this type:
if len(gl.b1ldframe) < 50:
gl.close_1ll += [gl.b1l_close]
# logger.info(f'gl.close_1ll = {gl.close_1ll}')
gl.rsi1l = RSI(14, input_values=gl.close_1ll)
gl.tsi1l = TSI(13, 25, input_values=gl.close_1ll)
if gl.rsi1l[-1] != gl.rsi1l[-1]:
xlst = gl.b1l_bar + [0.0]
else:
xlst = gl.b1l_bar + [gl.rsi1l[-1]]
if gl.tsi1l[-1] != gl.tsi1l[-1]:
xlst = xlst + [0.0]
else:
xlst = xlst + [gl.tsi1l[-1]]
else:
RSI and TSI needs for my data(S&P2000, future) more than 30 bars to calculate a value, NaNs at start.
RSI, TSI values for 1st 50 bars.
When the second part of code is executed (see gl.rsi1l.add(gl.b1l_bar[4]), error message occurs:
File "name.py", line 394, in genbars
xlst = gl.b1l_bar + [gl.rsi1l.add(gl.b1l_bar[4])[-1]]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
TypeError: 'NoneType' object is not subscriptable
#################################################
Thank you very much in advance for your time and help.
With my regards,
Hynek Sechovsky
[email protected]. Stisknutím tabulátoru návrh vložíte.
Strana 1 z 2
The text was updated successfully, but these errors were encountered: