python-tradingview-ta icon indicating copy to clipboard operation
python-tradingview-ta copied to clipboard

Any way to replicate library results with own data?

Open maledetu opened this issue 3 years ago • 2 comments

Hi! Thanks for this great library.

Id like to know if it is possible to replicate the recomendations and values from the library with my own data instead of tradingview for the purpose of backtesting strategies based on the recomendations.

Bye!

maledetu avatar Apr 10 '22 15:04 maledetu

Hello,

You can use the compute functions available in the Compute class. As these functions are low-level, they are not documented in RTD. However, the functions have docstrings that explain what they do. Here's an example to get you started:

from tradingvew_ta import Compute

# For RSI indicator use Compute.RSI
print(Compute.RSI(rsi, rsi1))
# Example output: BUY

# For MACD indicator use Compute.MACD
print(Compute.MACD(macd, signal))
# Example output: SELL

# Etc

You can then count the number of BUY, NEUTRAL, and SELL and check which one is the highest.

I hope this answers your question. Just let me know if you still have questions or problems. Have a good one!

folfcoder avatar Apr 11 '22 00:04 folfcoder

Thank you for the explanation, i think ill be able to achieve what i want. If i have any questions ill post here!

Have a good day :)

maledetu avatar Apr 13 '22 12:04 maledetu