I am trying to create an RSI indicator in excel using Python. I was able to create columns in the CSV file that was downloaded by Pandas datareader. However, I need to create a column for upward movement and downward movement where if there was a price increase greater than 0 than previous closing price then it should populate that difference else 0. I am not able to get that. Can someone help me? Thank you!
if msft_df['Gains/Loss'] > 0:
msft_df['Upward Movement'] = msft_df['Gains/Loss']
else:
msft_df['Upward Movement'] = 0