import pandas as pd
import matplotlib.pyplot as plt

# Sample stock price data
data = {
'Date': ,
'Price':
}

# Convert data to DataFrame
df = pd.DataFrame(data)

# Calculate 50-day moving average
df = df.rolling(window=50).mean()

# Plotting
plt.figure(figsize=(10, 6))
plt.plot(df, df, label='Price')
plt.plot(df, df, label='50-day MA')
plt.xlabel('Date')
plt.ylabel('Price')
plt.title('Stock Price with 50-day Moving Average')
plt.legend()
plt.show()
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.