Introduction
I recently learned how to plot Simple Moving Averages
(abbreviated "SMA") using the
Problem
When comparing the chart printed by my script against the chart displayed by Binance:
It is evident that the largest moving average (the one of 99
value) was not plotted as such, or it was, but I think because of the size set (figratio=(10, 6)
) for the same plot it ended up not appearing.
The Question
How could I make my script do a kind of Zoom out so that when printing the graph it shows the moving average of 99
without affecting the display of the other elements printed in the graph?.
CodePudding user response:
This looked like an issue of ylim
to me. According to the documentation of
The code provided was giving as an error, raise TypeError('Expect data.index as DatetimeIndex')
, so I modified the code to:
df_trading_pair = pd.read_csv('data.csv', index_col="Start Date", parse_dates=True)
def set_DateTimeIndex(df_trading_pair):
# Rename the column names for best practices
df_trading_pair.rename(columns = { "Open Price" : 'Open',
"High Price" : 'High',
"Low Price" : 'Low',
"Close Price" :'Close',}, inplace = True)
return(df_trading_pair)
CodePudding user response: