Script for close order automatically

MQL5 Scripts C++

Job finished

Execution time 2 days

Specification

I trade multiple pairs with a automated signal provided from another platform.


Existing method: when mt4/mt5 receives the buy or sell signal it will execute the order automatically. But it doesn't close the previously running position in the same pair.


Requirement:

Script should work @ each order is executed(buy/sell).

Only one trade will be there per symbol at any point of time. if mt4/mt5 receives a signal it will execute the orders. Now script will check for more than one order in any symbol. If there is more than one order in a symbol the script should close the older order.

For example: if mt4/mt5 receives a sell signal it will be executed automatically. now the script should check for the more than one order condition in that symbol if there is more than one trade (Sell executed now and a buy is running already and its a older order) the script should close older orders and the latest should be active and running.


NOTE: need this script in both mt4 and mt5

Responded

1
Developer 1
Rating
(192)
Projects
232
30%
Arbitration
1
100% / 0%
Overdue
9
4%
Free
Published: 2 codes
2
Developer 2
Rating
(12)
Projects
12
25%
Arbitration
0
Overdue
1
8%
Free
3
Developer 3
Rating
(20)
Projects
29
55%
Arbitration
0
Overdue
0
Free
4
Developer 4
Rating
(430)
Projects
606
55%
Arbitration
48
23% / 56%
Overdue
176
29%
Free
5
Developer 5
Rating
(349)
Projects
463
51%
Arbitration
41
24% / 49%
Overdue
149
32%
Free
6
Developer 6
Rating
(19)
Projects
27
19%
Arbitration
6
33% / 33%
Overdue
2
7%
Free
7
Developer 7
Rating
(34)
Projects
51
43%
Arbitration
5
40% / 20%
Overdue
14
27%
Free
Published: 2 codes
8
Developer 8
Rating
(65)
Projects
71
30%
Arbitration
8
0% / 88%
Overdue
5
7%
Free
9
Developer 9
Rating
(7)
Projects
10
60%
Arbitration
4
0% / 75%
Overdue
3
30%
Free
Published: 75 articles, 5 codes
10
Developer 10
Rating
(12)
Projects
13
23%
Arbitration
7
0% / 71%
Overdue
3
23%
Working
11
Developer 11
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
12
Developer 12
Rating
(45)
Projects
91
13%
Arbitration
34
26% / 59%
Overdue
37
41%
Free
13
Developer 13
Rating
(49)
Projects
134
27%
Arbitration
62
13% / 53%
Overdue
58
43%
Free
Published: 324 articles, 1 code
14
Developer 14
Rating
(54)
Projects
65
52%
Arbitration
5
40% / 60%
Overdue
22
34%
Working
15
Developer 15
Rating
(64)
Projects
144
46%
Arbitration
20
40% / 20%
Overdue
32
22%
Free
Similar orders
PLATFORM: MetaTrader 5 (MQL5) ASSET: XAUUSD (Gold) ACCOUNT TYPE: Live Raw Spread Account (Floating Spread + Commission) 500x leverage The broker commission is exactly 3 usd per standart lot per side6.00 round turn). The EA's internal trade tracking, net profit/loss metrics, and trailing drawdown calculations must completely factor in these commission charges alongside the raw asset spread. I need a clean, optimized
I am in need of creating a new like crypto coin, I need experts to evaluate my idea,---- --------------- ------------ - -------------------------------------- ----------------------- ------------- ---------------------------------- ----------------------------------------------------------------------- ------------------------------------------------------------------------
Siraj Durrani 30 - 50 USD
Title: Need MT4 Expert Advisor for XAUUSD (SMC/ICT Strategy) Requirements: I need a professional MT4 Expert Advisor (EA) for XAUUSD based on Smart Money Concepts (SMC) / ICT strategy. Features: - Platform: MetaTrader 4 (MT4) - Symbol: XAUUSD - Automatic Buy and Sell trades. - Detect market trend automatically. - Use Break of Structure (BOS) and Change of Character (CHoCH) for trend confirmation. - Enter trades only
Xauusd to gold 35+ USD
The EA must be fully automated , backtest-friendly , prop-firm-safe , and built with a clean modular architecture . Core Strategy Requirements 1. Higher Timeframe Bias Use D1 and H4 . Use 200 EMA as trend filter: If price is above 200 EMA on both D1 and H4 -> allow BUY only If price is below 200 EMA on both D1 and H4 -> allow SELL only If D1 and H4 are not aligned -> no trade 2. Market Structure Module Detect and
Pine Script Integration Request (Experienced Coders Only) I am looking for a highly experienced Pine Script developer to integrate a Demand & Supply Zone module into my existing indicator. Requirements Keep my current indicator (Rudy) exactly as it is. Do NOT modify, remove, or alter any existing logic, calculations, signals, alerts, or visual elements. Add only the Demand & Supply Zone boxes from a second Pine
🔍 Strategy Logic 📌 Indicators Used 21 EMA RSI (Upper Level: 61, Lower Level: 39 – Customizable) 📈 Buy Side Setup (Long Entry) Step 1 – Trend Confirmation A Green candle must close above 21 EMA. Step 2 – Pattern Formation After the green candle, observe next 4 candles. At least one Red candle must form (opposite candle). That Red candle must also close above EMA. Step 3 – Key Level Marking Mark the High of the Red
Title Professional AI Automation Trading Bot for Forex & Crypto Solution Language Python (preferred) or MQL5 depending on integration requirements. Categories Expert Advisor (EA) for MetaTrader 5 Automated trading strategies AI/ML-based signal generation Risk management automation Required Skills Strong knowledge of MQL5/Python Experience with MetaTrader API integration Machine learning model deployment
I need an Ai trading bot for Binance and BTC on MT5 that also uses order flow data. It should also make use of TSI- Temporal indicator sampling and also it should make use of fundamental analysis in the process of signal generation
Title: MT5 Forex Trading Robot Development I need a MetaTrader 5 (MT5) Expert Advisor (EA) for automated Forex trading. Requirements: 1. The robot must be fully automated and capable of opening and closing trades without manual intervention. 2. Compatible with MetaTrader 5 (MT5). 3. Adjustable lot size, Stop Loss, and Take Profit settings. 4. Built-in risk management based on account balance. 5. Ability to trade

Project information

Budget
30 - 40 USD