Trading Signal System - Installation Guide
Step 1: System Requirements
- Server: Linux VPS or Windows Server with PHP 7.4+ and MySQL 5.7+
- Python: Python 3.8+ with pip
- MetaTrader 5: MT5 terminal installed on the same machine
- Extensions: PHP extensions: pdo, pdo_mysql, openssl, exec
Step 2: Database Setup
1. Create a MySQL database named 'trading_signals'
2. Run the database setup script:
php database_setup.php
3. Update database credentials in config.php
Step 3: Python Dependencies
Install required Python packages:
pip3 install MetaTrader5==5.0.45
pip3 install mysql-connector-python==8.2.0
chmod +x execute_order.py
Step 4: Security Configuration
1. Change the encryption key in config.php
2. Update the API key in api.php
3. Change default admin password after first login
define('ENCRYPTION_KEY', 'your-unique-32-character-key-here');
$valid_api_key = 'your-secret-api-key-here';
Step 5: File Permissions
chmod 755 *.php
chmod 755 pages/
chmod +x execute_order.py
chmod 666 maintenance.log (create empty file first)
Step 6: Cron Job Setup (Optional)
Add this to your crontab for automatic maintenance:
# Run every hour to clean expired orders
0 * * * * /usr/bin/php /path/to/your/site/cron_monitor.php
⚠️ Important Security Notes
- Never store MT5 passwords in plain text (the system encrypts them)
- Use HTTPS in production
- Restrict access to admin panel by IP if possible
- Regularly update all dependencies
- Monitor log files for suspicious activity
Step 7: First Time Setup
- Visit login.php and login with: admin/admin123
- Go to "Manage Accounts" and add your MT5 accounts
- Test with a small trade signal first
- Monitor the "View Orders" page for execution status
✅ API Usage Examples
Send Signal via API:
curl -X POST "http://bot.trade1plus.lk/api.php" \
-d "api_key=your-secret-api-key" \
-d "action=send_signal" \
-d "symbol=EURUSD" \
-d "action_type=BUY" \
-d "lot=0.01" \
-d "sl=1.1000" \
-d "tp=1.1100"
Troubleshooting
- Orders stuck in PENDING: Check if MT5 terminal is running and logged in
- Python errors: Verify MetaTrader5 library is installed correctly
- Database errors: Check MySQL credentials and permissions
- Permission errors: Ensure web server can execute Python scripts