def setUp(self, df): self.df = df if self.indicators is not None: # Create all asked indicators for indicator in self.indicators: # Create a list of all arguments that are not the indicator name or column name exclude_keys = set(['indicator_name', 'col_name']) args = [indicator[k] for k in set(list(indicator.keys())) - exclude_keys] AddIndicator(self.df, indicator['indicator_name'], indicator['col_name'], *args)
def Maine(): exchange = Binance() symbol = 'BTCUSDT' df = exchange.getSymbolKlines(symbol, '1d') AddIndicator(df, 'sma', 'volma', 'volume', 10) signal = df.loc[df['volume'] > 2.4 * df['volma']] s_list = [ dict(name='S/R', points=[(row['time'], row['high']) if row['close'] > row['open'] else (row['time'], row['low']) for i, row in signal.iterrows()]) ] HA(df, ['open', 'high', 'low', 'close']) ha_df = df ha_df['open'] = df['HA_open'] ha_df['high'] = df['HA_high'] ha_df['low'] = df['HA_low'] ha_df['close'] = df['HA_close'] lines = [] last_time = df['time'][len(df) - 1] for s in s_list[0]['points']: line = go.layout.Shape( type="line", x0=s[0], y0=s[1], x1=last_time, y1=s[1], ) lines.append(line) PlotData( ha_df, show_plot=True, signals=s_list, plot_shapes=lines, plot_indicators=[dict(name='volma', title="Volume MA", yaxis='y2')])
def setup(self, df): self.df = df AddIndicator(self.df, "rsi", "rsi", "close", self.rsi_len) AddIndicator(self.df, "lbb", "lbb", "close", self.bb_len) AddIndicator(self.df, "ubb", "ubb", "close", self.bb_len)
def setup(self, df): self.df = df AddIndicator(self.df, "sma", "sma_fast", "close", self.fast) AddIndicator(self.df, "sma", "sma_slow", "close", self.slow)
def setup(self, df): self.df = df AddIndicator(self.df, "rsi", "rsi_"+str(self.rsi_len_1), self.rsi_len_1) AddIndicator(self.df, "rsi", "rsi_"+str(self.rsi_len_2), self.rsi_len_2) AddIndicator(self.df, "rsi", "rsi_"+str(self.rsi_len_3), self.rsi_len_3)
def setup(self): AddIndicator(self.df, "rsi", "rsi", self.rsi_len) AddIndicator(self.df, "lbb", "lbb", self.bb_len) AddIndicator(self.df, "ubb", "ubb", self.bb_len)
def setup(self, df): self.df = df AddIndicator(self.df, "ott", ["var", "ott"], self.pds, self.percent)
def setup(self, df): self.df = df AddIndicator(self.df, "smoothrng", "smoothrng_" + str(self.per), self.per, self.mult)
def setup(self): AddIndicator(self.df, "sma", "sma_fast", self.fast) AddIndicator(self.df, "sma", "sma_slow", self.slow)