Skip to content

Commit

Permalink
Merge pull request #90 from Pankaj4152/patch-5
Browse files Browse the repository at this point in the history
indicator graph improved
  • Loading branch information
jvedsaqib authored Oct 8, 2024
2 parents 150e6e8 + be3a837 commit 0244649
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Python File/Stock_Price_Prediction_REMOTE_20502.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@
],
"source": [
"fig, ax1 = plt.subplots(figsize=(10, 6))\n",
"\n",
"ax1.plot(df[\"SMA_10\"], label = \"SMA_10\", color='Red', linewidth=1, alpha=0.8)\n",
"ax1.plot(df[\"SMA_50\"], label = \"SMA_50\", color='Green', linewidth=1, alpha=0.8)\n",
"ax1.plot(df[\"Close\"], label = \"Close\", color='Blue', linewidth=2)\n",
"days = int(input(\"of how many past days you want to see graph: \"))\n",
"ax1.plot(df[\"SMA_10\"][-days:], label = \"SMA_10\", color='Red', linewidth=1, alpha=0.8)\n",
"ax1.plot(df[\"SMA_50\"][-days:], label = \"SMA_50\", color='Green', linewidth=1, alpha=0.8)\n",
"ax1.plot(df[\"Close\"][-days:], label = \"Close\", color='Blue', linewidth=2)\n",
"\n",
"plt.legend()\n",
"plt.show()"
Expand Down Expand Up @@ -397,14 +397,15 @@
"# Create subplots\n",
"fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 8), gridspec_kw={'height_ratios': [3, 1]})\n",
"\n",
"days = int(input(\"of how many past days you want to see graph: \"))\n",
"# price graph\n",
"ax1.plot(df['Close'], label='Close Price', color='blue')\n",
"ax1.plot(df['Close'][-days:], label='Close Price', color='blue')\n",
"ax1.set_title('Stock Price')\n",
"ax1.set_ylabel('Price')\n",
"ax1.legend()\n",
"\n",
"# rsi graph\n",
"ax2.plot(df['RSI'], label='RSI', color='orange')\n",
"ax2.plot(df['RSI'][-days:], label='RSI', color='orange')\n",
"ax2.axhline(70, color='red', linestyle='--') # Overbought line\n",
"ax2.axhline(30, color='green', linestyle='--') # Oversold line\n",
"ax2.set_title('Relative Strength Index (RSI)')\n",
Expand Down Expand Up @@ -725,14 +726,15 @@
"fig, ax = plt.subplots(2, 1, figsize=(10, 8))\n",
"\n",
"\n",
"days = int(input(\"of how many past days you want to see graph: \"))\n",
"# Plot stock price on first subplot (bold)\n",
"ax[0].plot( df['Close'], label='Close Price', color='blue', linewidth=3)\n",
"ax[0].plot( df['Close'][-days:], label='Close Price', color='blue', linewidth=3)\n",
"ax[0].set_title('Stock Price')\n",
"ax[0].set_ylabel('Price')\n",
"\n",
"# Plot MACD and Signal line on second subplot\n",
"ax[1].plot( df['MACD'], label='MACD', color='green', linewidth=2)\n",
"ax[1].plot( df['Signal_Line'], label='Signal Line', color='red', linestyle='--', alpha=0.7)\n",
"ax[1].plot( df['MACD'][-days:], label='MACD', color='green', linewidth=2)\n",
"ax[1].plot( df['Signal_Line'][-days:], label='Signal Line', color='red', linestyle='--', alpha=0.7)\n",
"ax[1].set_title('MACD')\n",
"ax[1].set_ylabel('MACD Value')\n",
"\n",
Expand Down

0 comments on commit 0244649

Please sign in to comment.