Project Analysis
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.
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
- 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
- Trained LSTM model on historical stock prices
- Forecasts short-term direction and momentum
- Integrated as a filter layer in trading logic
- Scraped financial headlines, tweets, and news
- Applied FinBERT to extract sentiment polarity score
- Used sentiment to confirm or reject trade direction
- Parsed financial ratios: P/E, ROE, EPS, market cap from APIs and earnings reports
- Used for stock ranking and to filter out risky trades
- Grouped stocks by sector (e.g., Tech, Pharma, Finance)
- Analyzed sector volatility, news flow, and index correlation (e.g., Bank Nifty vs. SBI)
- Correlated global indices (S&P 500, NASDAQ, FTSE) with domestic indices
- Detected global sentiment impact on Indian stock market
- 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
- Python
- Pandas
- NumPy
- TA-Lib
- TensorFlow / Keras – LSTM modeling
- HuggingFace Transformers – FinBERT model
- Matplotlib
- Plotly
- yfinance
- Alpha Vantage
- Screener APIs (for financial data)
- Django / FastAPI (backend)
- HTML / CSS / JavaScript (frontend)
- SQL
- CSV files
- 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
- Fetched market prices, global indices, sentiment data, and financials using APIs
- Handled null values and scaled numerical data
- Computed log returns
- Encoded categorical variables
- Created composite technical features (e.g., MACD cross + RSI < 30 + proximity to support)
- Derived sentiment scores and fundamentals ranking
- LSTM for trend prediction
- FinBERT for sentiment analysis
- Custom rule engine for technical signal interpretation
- Ensemble logic to combine AI, sentiment, and technical signals
- Ran simulated trades over historical periods
- Evaluated results using Profit/Loss, Accuracy, and Drawdown metrics
- 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
- 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