It looks like you're new here. If you want to get involved, click one of these buttons!
def rsi(df, period):
df['pnl'] = df['close'].diff()
df.loc[df['pnl'] >= 0, 'gain'] = df['pnl']
df['gain'].fillna(value=0, inplace=True)
df.loc[df['pnl'] < 0, 'loss'] = df['pnl'].abs()
df['loss'].fillna(value=0, inplace=True)
df['average_gain'] = df['gain'].ewm(com = period-1, min_periods=period).mean()
df['average_loss'] = df['loss'].ewm(com = period-1, min_periods=period).mean()
df['rs'] = df['average_gain'] / df['average_loss']
df['rsi'] = 100 - (100/(1+df['rs']))
return df
adding code for Bollinger band and macd also..
functions are in the file below
can you add code for Renko bars calculations?
You can reach me at 9370789912
https://github.com/arkochhar/Technical-Indicators/blob/master/indicator/indicators.py