The Foreign Exchange (FOREX) market exhibits high volatility, non-linearity, and strong temporal dependencies that traditional rule-based trading strategies fail to model effectively. This project implements a real-time FOREX Signal Prediction System using Long Short-Term Memory (LSTM) networks combined with neural feature prediction and a live Streamlit dashboard.
The system fetches live OHLC price data from the Twelve Data (12fdata) API, predicts key technical indicators using neural regression models, and generates Buy, Sell, or Hold trading signals with confidence scores, take-profit (TP), and stop-loss (SL) levels.
- Generate real-time Buy / Sell / Hold trading signals
- Capture temporal market behavior using LSTM
- Predict technical indicators using neural networks instead of formulas
- Visualize live signals through an interactive Streamlit dashboard
- Provide a practical decision-support tool for FOREX traders
The system follows a hybrid deep learning architecture:
- Live Data Ingestion
- OHLC data fetched from Twelve Data API
- Neural Feature Prediction
- EMA-10, EMA-50, ATR, Support, Resistance
- RSI predicted using a separate neural model
- LSTM Signal Model
- Uses rolling time windows to predict trade signals
- Risk Management Logic
- ATR-based Take Profit and Stop Loss calculation
- Streamlit Dashboard
- Real-time visualization and signal monitoring
Live market data is obtained using the Twelve Data REST API.
Configuration used in the project:
- Symbol:
EUR/USD - Interval:
5 minutes - Output size:
150 candles - Data fields: Open, High, Low, Close (OHLC)
- Open
- High
- Low
- Close
- Daily Range (High − Low)
- Exponential Moving Average (EMA-10)
- Exponential Moving Average (EMA-50)
- Relative Strength Index (RSI)
- Average True Range (ATR)
- Support Level
- Resistance Level
All indicators are predicted using trained neural networks, not calculated using traditional formulas.
- Fetch live OHLC data from Twelve Data API
- Create lag features for time-series learning
- Predict RSI using a dedicated neural network
- Predict EMA, ATR, Support & Resistance using a feature regression model
- Feed the last 20 timesteps into the LSTM model
- Predict Buy / Sell / Hold signal with confidence
- Compute ATR-based Take Profit (TP) and Stop Loss (SL)
- Log and visualize results in real time
- Predicts: EMA_10, EMA_50, ATR, Support, Resistance
- Input: OHLC + lag features
- Predicts RSI values from price history
- Separate scaler and neural network
- Input shape:
(1, 20, 11) - Output classes:
- Buy
- Sell
- Hold
- Mean Absolute Error (MAE)
- Signal confidence score
- Stability of Buy/Sell decisions
- Visual backtesting via live charts
- Python
- TensorFlow / Keras
- Pandas, NumPy
- Scikit-learn
- Streamlit
- Plotly
- Twelve Data (12fdata) API
# Clone the repository
git clone https://github.com/your-username/forex-signal-prediction.git
cd forex-signal-prediction
# Get your 12data API Key
# Install dependencies
pip install -r requirements.txt
# Run the Streamlit dashboard
streamlit run dashboard.py