Transform your trading workflow with a single-click order management solution designed for institutional-grade precision across MetaTrader 4 and MetaTrader 5 platforms.
TradeForge is not merely a scriptβit is an orchestration engine for your trading operations. Inspired by the need to close orders efficiently, this repository evolves the concept into a cross-platform command center that handles order lifecycle management with surgical accuracy.
Imagine your trading terminal as a bustling airport control tower. Each order is an aircraft requiring clearance for departure, landing, or rerouting. TradeForge becomes your radar systemβvisualizing every flight path and enabling immediate, coordinated action.
| Challenge | Solution |
|---|---|
| Manual order closures waste seconds (compounded over weeks) | One-click bulk operations |
| Distinguishing profitable vs losing positions requires mental math | Automated profit/loss detection |
| MT4 and MT5 have different scripting paradigms | Unified execution layer |
| Risk management delays during volatile markets | Instant position management |
graph TB
A[User Interface Layer] --> B[Core Engine]
B --> C[MT4 Connector]
B --> D[MT5 Connector]
C --> E[Order Scanner]
D --> E
E --> F{Profit/Loss Classifier}
F -->|Profit > 0| G[Profitable Orders Pool]
F -->|Profit < 0| H[Losing Orders Pool]
F -->|Profit = 0| I[Breakeven Orders Pool]
G --> J[Execution Queue]
H --> J
I --> J
J --> K[Risk Validator]
K --> L[Batch Closure Engine]
L --> M[Trade Confirmation Log]
M --> N[Audit Trail Database]
β
MetaTrader 4 Build 1400+
β
MetaTrader 5 Build 4500+
β
FIFO-compliant brokers
β
Hedged account support
- Total Sweep β Close all open positions
- Green Harvest β Close only profitable orders
- Red Alert β Close only losing orders
- Custom Filter β Close orders by symbol, magic number, or comment
The system uses a dual-layer profit assessment:
- Raw P&L β Current floating profit/loss
- Weighted P&L β Adjusted for swap fees and commission charges
| Language | Support Level |
|---|---|
| English | Full |
| Spanish | Full |
| French | Full |
| German | Full |
| Mandarin | Full |
| Arabic | Interface only |
| Russian | Interface only |
- MetaTrader 4 or MetaTrader 5 installed
- Windows 7/10/11, macOS (via Wine), or Linux (via Wine)
- Administrator privileges for DLL imports
-
Extract the archive to your
MQL5/Experts/(MT5) orMQL4/Experts/(MT4) directory -
Configure your settings (see Profile Configuration below)
-
Compile in MetaEditor (F7)
-
Attach to a chart β Drag from Navigator or use the Strategy Tester
Create a tradeforge_config.ini file in the Files folder:
[General]
mode=sweep_all
slippage=10
magic_number=0
comment_filter=
auto_confirm=true
[Safety]
max_orders_per_second=3
min_profit_threshold=0.50
max_loss_threshold=-100.00
disable_during_news=true
[Logging]
log_level=verbose
save_trades_to_csv=true
audit_file=TradeForge_Audit_2026.log
[Alerts]
send_sound=true
sound_file=alert.wav
popup_notification=true
[BrokerSettings]
fifo_mode=auto_detect
hedge_mode=auto_detectFor advanced users running via Expert Advisor automation:
// Example MQL5 call from within an EA
#include <TradeForge/TradeForge.mqh>
CTradeForge tradeForge;
void OnTick()
{
if(ShouldCloseOrders())
{
tradeForge.SetMode(MODE_CLOSE_LOSING);
tradeForge.SetMagickNumber(12345);
tradeForge.Execute();
}
}Or via script parameters:
INPUT:
mode = 2 // 0=all, 1=profit, 2=loss
slippage = 5
use_comment_filter = false
| Operating System | Status | Notes |
|---|---|---|
| πͺ Windows 7 | β Full | All features |
| πͺ Windows 10 | β Full | Recommended |
| πͺ Windows 11 | β Full | Optimized |
| π macOS Ventura | GUI limited | |
| π macOS Sonoma | GUI limited | |
| π§ Ubuntu 22.04 | CLI mode only | |
| π§ Debian 12 | CLI mode only |
Trading foreign exchange on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange, you should carefully consider your investment objectives, level of experience, and risk appetite.
TradeForge is provided "as is" without warranty of any kind, express or implied. The authors and contributors shall not be held liable for any direct, indirect, incidental, special, exemplary, or consequential damages arising from the use of this software.
- β Maximum order execution rate limiting
- β Automatic disable during high-impact news events
- β Audit trail for every executed order
- β Slippage control with broker-specific tolerance
TradeForge seamlessly integrates with modern AI assistants for enhanced decision support:
# Example Python wrapper for AI-assisted order analysis
import openai
def analyze_order_risk(orders_data):
response = openai.ChatCompletion.create(
model="gpt-4-turbo",
messages=[
{"role": "system", "content": "You are a risk management assistant analyzing trading orders."},
{"role": "user", "content": f"Analyze these orders and recommend closure strategy: {orders_data}"}
]
)
return response.choices[0].message.content# Example Claude integration for market context analysis
import anthropic
def get_market_advice(trade_context):
client = anthropic.Anthropic(api_key="sk-ant-...")
message = client.messages.create(
model="claude-3-sonnet-20240229",
max_tokens=1000,
messages=[
{"role": "user", "content": f"Based on current market conditions: {trade_context}, should we close all positions?"}
]
)
return message.contentTradeForge features a fully responsive UI that adapts to your screen resolution:
- Desktop: Full dashboard with real-time P&L monitoring
- Tablet: Compact mode with essential controls
- Mobile: Minimal interface for emergency order closure
The interface follows Material Design 3 principles with:
- Adaptive color schemes for day/night trading
- Touch-friendly button sizes
- Collapsible panels for complex settings
While this is an open-source project, we maintain a community-driven support ecosystem:
| Channel | Response Time | Hours |
|---|---|---|
| GitHub Issues | <24 hours | Business days |
| Community Discord | <2 hours | 24/7 |
| Documentation Wiki | Self-service | Always available |
| Email Priority | <4 hours | Business hours |
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 TradeForge Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
MetaTrader order management, MT4/MT5 automation, trading bot script, forex position closer, bulk order cancellation, profit-taking automation, stop-loss execution, multi-terminal trade manager, algorithmic trading tools, broker-agnostic execution, MQL5 expert advisor, MQL4 script, financial automation, risk management software, trading terminal enhancer, zero-cost trading utility, open-source trade manager, cross-platform trading tool, institutional trading software, 2026 trading innovations.
TradeForge β Because every second counts when markets move. ππ°
Made with β€οΈ for the trading community. Contributions welcome via pull requests.