ta-lib-python
ta-lib-python copied to clipboard
I need RSISMA maybe help me
I want to get the SMA of the RSI indicator, but I have not been successful. It's not in the command extension either. Can you help?
Are you looking for something like:
>>> import numpy as np
>>> c = np.random.randn(100)
>>> import talib as ta
>>> rsi = ta.RSI(c)
>>> sma = ta.SMA(rsi)
Also, what's a command extension?
def populate_indicators(self, dataframe: DataFrame, metadata: dict) ->
DataFrame: # RSI dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) # SMA dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14)
I wrote as above, it gives an error.
31 Eki 2022 Pzt 07:34 tarihinde John Benediktsson @.***> şunu yazdı:
Also, what's a command extension?
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1296529942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXQCVZ6UDKZF7M24PFUKILWF5D6HANCNFSM6AAAAAARSHIGEY . You are receiving this because you authored the thread.Message ID: @.***>
What is the error?On Oct 31, 2022, at 12:17 AM, inglor38 @.***> wrote: def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # RSI dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) # SMA dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14)
I wrote as above, it gives an error.
31 Eki 2022 Pzt 07:34 tarihinde John Benediktsson @.***> şunu yazdı:
Also, what's a command extension?
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1296529942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXQCVZ6UDKZF7M24PFUKILWF5D6HANCNFSM6AAAAAARSHIGEY . You are receiving this because you authored the thread.Message ID: @.***>
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Can't control outputs. After writing all the positive data in this way, it turns negative. It seems that rsi cannot take the sma when I examine it in detail.
31 Eki 2022 Pzt 16:25 tarihinde John Benediktsson @.***> şunu yazdı:
What is the error?On Oct 31, 2022, at 12:17 AM, inglor38 @.***> wrote: def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
RSI
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
SMA
dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14)
I wrote as above, it gives an error.
31 Eki 2022 Pzt 07:34 tarihinde John Benediktsson @.***> şunu yazdı:
Also, what's a command extension?
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1296529942, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AJXQCVZ6UDKZF7M24PFUKILWF5D6HANCNFSM6AAAAAARSHIGEY
. You are receiving this because you authored the thread.Message ID: @.***>
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297086360, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXQCV6E7252X5GTDGZZNCTWF7CEJANCNFSM6AAAAAARSHIGEY . You are receiving this because you authored the thread.Message ID: @.***>
I don’t understand.
If you provide an example showing the inputs and the incorrect outputs or error, perhaps I can help.
On Mon, Oct 31, 2022 at 6:31 AM inglor38 @.***> wrote:
Can't control outputs. After writing all the positive data in this way, it turns negative. It seems that rsi cannot take the sma when I examine it in detail.
31 Eki 2022 Pzt 16:25 tarihinde John Benediktsson @.***> şunu yazdı:
What is the error?On Oct 31, 2022, at 12:17 AM, inglor38 @.***> wrote: def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
RSI
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
SMA
dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14)
I wrote as above, it gives an error.
31 Eki 2022 Pzt 07:34 tarihinde John Benediktsson @.***> şunu yazdı:
Also, what's a command extension?
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1296529942, or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AJXQCVZ6UDKZF7M24PFUKILWF5D6HANCNFSM6AAAAAARSHIGEY
. You are receiving this because you authored the thread.Message ID: @.***>
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297086360, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AJXQCV6E7252X5GTDGZZNCTWF7CEJANCNFSM6AAAAAARSHIGEY
. You are receiving this because you authored the thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297096335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAF5A6RDAX5HKUEMVTZLDDWF7C27ANCNFSM6AAAAAARSHIGEY . You are receiving this because you commented.Message ID: @.***>
from freqtrade.strategy import IStrategy from pandas import DataFrame import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib from technical.util import resample_to_interval, resampled_merge from freqtrade.strategy import CategoricalParameter, DecimalParameter, IntParameter
class cingene(IStrategy):
INTERFACE_VERSION: int = 1
minimal_roi = {"0": 0.01}
stoploss = -0.02
timeframe = '15m'
can_short = True
startup_candle_count: int = 1
def populate_indicators(self, dataframe: DataFrame, metadata: dict) ->
DataFrame: # RSI dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) # SMA dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14) # Stoch fast stoch_fast = ta.STOCHF(dataframe, timeperiod=14) dataframe['fastd'] = stoch_fast['fastd'] dataframe['fastk'] = stoch_fast['fastk'] # MACD macd = ta.MACD(dataframe) dataframe["macd"] = macd["macd"] dataframe["macdsignal"] = macd["macdsignal"] dataframe["macdhist"] = macd["macdhist"]
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) ->
DataFrame: dataframe.loc[ ( (dataframe["rsi"] > dataframe["sma"]) & (dataframe["rsi"] <80)& (dataframe["fastk"] > dataframe["fastd"]) & (dataframe['macd'] > dataframe['macdsignal']) ), 'enter_long'] = 1 dataframe.loc[ ( (dataframe["rsi"] < dataframe["sma"]) & (dataframe["fastk"] < dataframe["fastd"]) & (dataframe['macd'] < dataframe['macdsignal']) ), 'enter_short'] = 1 return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) ->
DataFrame: dataframe.loc[ ( # (dataframe["rsi"] < dataframe["sma"])| # (dataframe["rsi"] >75)
),
'exit_long'] = 1
dataframe.loc[
(
# (dataframe["rsi"] > dataframe["sma"])
),
'exit_short'] = 1
return dataframe
All code is here. Dataframe["sma"] calculating wrong. When I compare, there is a big difference between binance and calculation.
31 Eki 2022 Pzt 16:32 tarihinde John Benediktsson @.***> şunu yazdı:
I don’t understand.
If you provide an example showing the inputs and the incorrect outputs or error, perhaps I can help.
On Mon, Oct 31, 2022 at 6:31 AM inglor38 @.***> wrote:
Can't control outputs. After writing all the positive data in this way, it turns negative. It seems that rsi cannot take the sma when I examine it in detail.
31 Eki 2022 Pzt 16:25 tarihinde John Benediktsson @.***> şunu yazdı:
What is the error?On Oct 31, 2022, at 12:17 AM, inglor38 @.***> wrote: def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
RSI
dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14)
SMA
dataframe["sma"] = ta.SMA(dataframe["rsi"], timeperiod=14)
I wrote as above, it gives an error.
31 Eki 2022 Pzt 07:34 tarihinde John Benediktsson @.***> şunu yazdı:
Also, what's a command extension?
— Reply to this email directly, view it on GitHub <https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1296529942 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AJXQCVZ6UDKZF7M24PFUKILWF5D6HANCNFSM6AAAAAARSHIGEY
. You are receiving this because you authored the thread.Message ID: @.***>
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297086360, or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AJXQCV6E7252X5GTDGZZNCTWF7CEJANCNFSM6AAAAAARSHIGEY
. You are receiving this because you authored the thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297096335, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAAF5A6RDAX5HKUEMVTZLDDWF7C27ANCNFSM6AAAAAARSHIGEY
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297098049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXQCVYGVVLDKL6OJTD2H2TWF7DAFANCNFSM6AAAAAARSHIGEY . You are receiving this because you authored the thread.Message ID: @.***>
compare RSI, not SMA
But i need rsisma compare rsi
31 Eki 2022 Pzt 17:14 tarihinde Alexander Trufanov @.***> şunu yazdı:
compare RSI, not SMA
— Reply to this email directly, view it on GitHub https://github.com/mrjbq7/ta-lib/issues/558#issuecomment-1297154983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXQCVY2CHOMLVEUGQ5MAKTWF7H3NANCNFSM6AAAAAARSHIGEY . You are receiving this because you authored the thread.Message ID: @.***>