Project Analysis
image

AI-Enhanced Technical Indicator-Based Stock Trading Strategy

About Project

Stock market forecasting often suffers from inconsistency due to noisy data, emotional trading, and the isolated use of indicators or sentiment. Traders lack a unified system that combines technical signals, sentiment analysis, and AI models to generate high-confidence trade decisions. Traditional methods based on single indicators (like MACD or RSI alone) often fail in volatile or uncertain markets.

Problem Statement

Traditional stock prediction methods fail to combine all key market signals — technical patterns, news sentiment, financial fundamentals, and global macroeconomic factors. This fragmented view results in missed opportunities, false signals, and poor portfolio decisions.

Proposed Solution

Retail investors and analysts need a single, AI-powered platform that:

  • Predicts price direction
  • Validates trades through sentiment and indicator signals
  • Considers global index trends and sector-specific insights
  • Provides a visual dashboard for decisions and backtesting

Objective

To develop a comprehensive trading and portfolio decision support system that integrates:

  • LSTM-based trend prediction
  • FinBERT sentiment analysis
  • Technical indicators (MACD, RSI, support/resistance, EMA)
  • Fundamental analysis (PE, EPS, financial ratios)
  • Sector-wise analysis (e.g., Tech, Pharma, Finance)
  • Global index comparison (S&P 500, NASDAQ, FTSE, Nifty 50)
  • Dashboard for visualization, filtering, and simulation

Proposed Solution

Technical Module
  • Custom-built rule-based system combining MACD, RSI, support/resistance, and EMA
  • Logic engine accepts trades only when multiple indicators align
  • Files: MACD.ipynb, intraday rsi+macd.ipynb, resistance and support.ipynb
AI Trend Prediction
  • Trained LSTM model on historical stock prices
  • Forecasts short-term direction and momentum
  • Integrated as a filter layer in trading logic
Sentiment Module
  • Scraped financial headlines, tweets, and news
  • Applied FinBERT to extract sentiment polarity score
  • Used sentiment to confirm or reject trade direction
Fundamental Module
  • Parsed financial ratios: P/E, ROE, EPS, market cap from APIs and earnings reports
  • Used for stock ranking and to filter out risky trades
Sector-Wise Analysis
  • Grouped stocks by sector (e.g., Tech, Pharma, Finance)
  • Analyzed sector volatility, news flow, and index correlation (e.g., Bank Nifty vs. SBI)
Global Index Correlation
  • Correlated global indices (S&P 500, NASDAQ, FTSE) with domestic indices
  • Detected global sentiment impact on Indian stock market
Dashboard & Deployment
  • Upload or select a stock for analysis
  • View LSTM-based trend prediction
  • Check technical indicator alignment
  • See sentiment polarity scores
  • Compare sector trends
  • Get portfolio risk suggestions
  • Built with Streamlit or Flask (depending on version)

Technologies Used

Core Logic
  • Python
Data Wrangling & Indicators
  • Pandas
  • NumPy
  • TA-Lib
AI & Trend Prediction
  • TensorFlow / Keras – LSTM modeling
Sentiment Analysis
  • HuggingFace Transformers – FinBERT model
Visualization
  • Matplotlib
  • Plotly
Data Sources
  • yfinance
  • Alpha Vantage
  • Screener APIs (for financial data)
Web Framework & Dashboard
  • Django / FastAPI (backend)
  • HTML / CSS / JavaScript (frontend)
Data Storage
  • SQL
  • CSV files
External APIs
  • Financial statements APIs
  • Sector-wise and global index data APIs

Challenges Faced

  • Aligning and synchronizing data across different timeframes (e.g., daily RSI vs. intraday LSTM)
  • Fine-tuning the sentiment model with domain-specific financial vocabulary
  • Combining qualitative and quantitative data (e.g., news sentiment + PE ratio + MACD) for holistic decision-making
  • Preventing overfitting in LSTM due to limited historical data windows
  • Designing a clean, low-latency dashboard capable of real-time model output
  • Handling ambiguous or overlapping sector classifications (e.g., hybrid companies)

Methodology

Data Collection
  • Fetched market prices, global indices, sentiment data, and financials using APIs
Data Preprocessing
  • Handled null values and scaled numerical data
  • Computed log returns
  • Encoded categorical variables
Feature Engineering
  • Created composite technical features (e.g., MACD cross + RSI < 30 + proximity to support)
  • Derived sentiment scores and fundamentals ranking
Modeling
  • LSTM for trend prediction
  • FinBERT for sentiment analysis
  • Custom rule engine for technical signal interpretation
  • Ensemble logic to combine AI, sentiment, and technical signals
Backtesting
  • Ran simulated trades over historical periods
  • Evaluated results using Profit/Loss, Accuracy, and Drawdown metrics
Visualization & Deployment
  • Designed an interactive dashboard interface
  • Enabled filtering by stock, sector, or sentiment

Result / Outcome

  • Achieved over 78% accuracy in directional prediction when sentiment and technical signals aligned
  • Provided 5–20% improved ROI compared to basic indicator or LSTM-only models
  • Dashboard allowed users to simulate strategies, visualize trades, and rank sectors effectively
Key Capabilities Enabled
  • Predict market direction using AI (LSTM + FinBERT)
  • Confirm trades with technical indicators (MACD, RSI, EMA, support/resistance)
  • Filter stocks based on fundamentals (e.g., P/E, EPS, ROE)
  • Adapt strategies based on sector and global index trends

EDA
ML MODEL