Fix my EA: Close open and pending orders and some minor fixes

MQL4 Experts

Job finished

Execution time 9 minutes
Feedback from employee
Great Customer, Thanks...
Feedback from customer
Finished the job and was faster than expected (within half day). He provided me some really great feedback. Also provided his honest opinion and gave me some good advice.

Specification

EA trades on Bollinger Bands, in general executing orders is fine. However, I need some optimization of my EA. Two request are adding code, while two requests are more reviewing the code.

 

1. Major Optimization: Close open and pending orders Symbol when hit TakeProfit 

My EA will open one buy/sell order and 8 pending buylimit/selllimit at the same time when it opens. I want the EA to close the open orders and delete the pending orders of that particular symbol once one of the open order hit Takeprofit. 

As described in below table when Order 4, (Buy order, 0.08 size) hit the TP it will close the two order buy orders and delete the BuyLimit pending orders. So only the Sell orders and SellLimit pending orders remain afterwards. 

Open
OrderOrdertypelotsizeSymbolPriceS/LTPPrice (closed)
1Buy0.02EURUSD1.10551.031.106Close
2Sell0.02EURGBP1.311.31No change
3Buy0.04EURUSD1.10541.031.1055Close
4Buy0.08EURUSD1.10531.031.10541.1054
5Sell0.04EURGBP1.2911.31No change
Pending
1BuyLimit0.16EURUSD1.281.031.1053Delete
2BuyLimit0.32EURUSD1.271.031.1052Delete
3BuyLimit0.64EURUSD1.261.031.1051Delete
4BuyLimit1.28EURUSD1.251.031.105Delete
5BuyLimit2.56EURUSD1.241.031.104Delete
6BuyLimit5.12EURUSD1.231.031.103Delete
7SellLimit0.08EURGBP1.2811.31No change
8SellLimit0.16EURGBP1.2711.31No change
9SellLimit0.32EURGBP1.2611.31No change
10SellLimit0.64EURGBP1.2511.31No change
11SellLimit1.28EURGBP1.2411.31No change
12SellLimit2.56EURGBP1.2311.31No change
13SellLimit5.12EURGBP1.2211.31No change

 

2. Check: Not all OrderSend are send to server

I encountered that in a few cases some of my predefined OrderSends are not triggered, a few times it was the 0.04 Lotsize. I cannot find the order back in the history or trade information.That could be fault of server or it could be that my code is written incorrectly. Please check the OrderSend for Buy and Sell.

 

3. Check: Sometimes buy/sell order are closed way too early

Sometimes my orders are triggered but after a few seconds it closes by itself again without hitting the TP or SL. I am not sure what triggered this.

 4. Add: Maximum one set of buy/sell orders per bar chart

I want to limit the set of buy order/buylimits to one set per bar. Sometimes the orders are triggered again since my buy condition is still valid. This should be as well for the sell orders/sell limits

For your information; I included a file in the MQ4 but I believe I won't use it . Though I added in case you need it


 

Files:

MQH
Trade.mqh
31.2 Kb

Responded

1
Developer 1
Rating
(26)
Projects
29
3%
Arbitration
11
9% / 73%
Overdue
3
10%
Free
Published: 1 code
2
Developer 2
Rating
(414)
Projects
670
33%
Arbitration
60
17% / 32%
Overdue
113
17%
Working
3
Developer 3
Rating
(2)
Projects
2
0%
Arbitration
13
8% / 92%
Overdue
1
50%
Free
Similar orders
https://www.youtube.com/watch?v=xMNx8f-aGQE&amp ;t=56s risk 1% per trade watch the video carefully and automate the trade setups in XAUUSD i prefer picking the least drawdown and good return expert advisor do not use overfitting(Strict) account type : hedging
Vb flesh 30+ USD
#property strict #property version "1.00" #include <Trade/Trade.mqh> CTrade trade; // ===== ROBOT SETTINGS ===== input double Lots = 0.01; input int FastEMA = 9; // Blue line input int SlowEMA = 21; // Red line input int StopLossPoints = 300; input int TakeProfitPoints = 600; input ulong MagicNumber = 123456; // ===== INDICATOR HANDLES ===== int blueHandle; int redHandle; datetime lastBar = 0;
Bonjour , je cherche quelqu’un capable de crée un bot sur le gold type HFT , ouverture de plusieurs positions en quelques secondes , robot agressif , je cherche un robot qui marche sur du réel , qui a déjà était tester avec des résultats, pas basé que sur des backtest
Hello, I'm looking for an experienced MQL5 developer to build a clean and reliable Opening Range Breakout Expert Advisor for MetaTrader 5. I have previously experienced problems with EAs placing duplicate pending orders after terminal or VPS restarts. My priority is reliable execution, sensible risk management and an EA that I can confidently test and maintain. 1. Opening Range Strategy Platform: MetaTrader 5
Hi everyone. I came across a bot named ( Super Scalping EA Gold Tick Scalper ) in the free bots section on MQL5, and I’ve seen its trading results over a two-year period. I would like one of you to create a similar bot for gold trading that achieves the same (or very similar) results, but within a shorter timeframe—specifically 6 to 8 months. I also need the bot to be suitable for both small accounts ($30–$50) and
i have existing EA but its decrypted i dont have its source code , i want you to decrypt the EA and give me the original source code of it
Project: Custom MT5 Day Trading Expert Advisor I need a custom automated trading robot (EA) for MetaTrader 5, developed in MQL5. Markets: - Gold (XAUUSD) - Selected Forex pairs Trading style: Automated day trading. All positions should be closed according to predefined strategy rules and before the end of the selected trading session. Strategy: The developer should propose a clear trading strategy, explain its rules
Hi, I need NinjaTrader 8 Strategy Analyzer backtests on two of my strategies, each over 1 year AND 3 years of data. Please quote the full job. Common settings: NT8 Strategy Analyzer, MCL (Micro WTI Crude Oil) continuous front-month contract (MCL ##-##), 5-minute bars, 1yr + 3yr of the most recent data, $2.50 round-turn commission per contract. Deliverables per run: full Strategy Analyzer summary (net profit, profit
Hi, I need NinjaTrader 8 Strategy Analyzer backtests on two of my strategies, each over 1 year AND 3 years of data. Please quote the full job. Common settings: NT8 Strategy Analyzer, MCL (Micro WTI Crude Oil) continuous front-month contract (MCL ##-##), 5-minute bars, 1yr + 3yr of the most recent data, $2.50 round-turn commission per contract. Deliverables per run: full Strategy Analyzer summary (net profit, profit
1. Overview Build an MQL5 Expert Advisor for MetaTrader 5 that trades XAUUSD (Gold) as a scalper, using Heiken Ashi candles and a 50 EMA for entries. 2. Platform and symbol MetaTrader 5, Expert Advisor (.mq5 and compiled .ex5) Symbol: XAUUSD (must work with broker suffixes, e.g. XAUUSDm) Default timeframe: M5 (configurable; M1 to M15 should work) 3. Indicators Heiken Ashi candles, calculated inside the EA (no

Project information

Budget
20 - 30 USD