Update my simple EA to fix “invalid pointer access”, ensure reliable trade opening, and restrict maximum number of trades per signal

Работа завершена

Время выполнения 6 дней
Отзыв от заказчика
Paul is the best developer I have ever worked with. He is extremely attentive to details, very patient, and super helpful and responsive. He completed the project on time. I highly recommend him.
Отзыв от исполнителя
Great client to work with. Quick communication.

Техническое задание

My current EA (I will refer to it as OP) opens opposite pending orders based on existing open trades in the terminal.


Example of how OP works:

1) Let's say I manually or automatically (through a different EA) open a buy trade for EURUSD with open price of 1.10000, SL of 1.00000, and TP of 1.20000

(magic number is 100, order comment is "euro breakout", and symbol is of course EURUSD)


2) OP will then identify open trades to act on based on magic number, order comment, or symbol. There are three different entry fields in the settings, for the user to type in the magic number, order comment, or symbol of the open trade that they want OP to identify and base its trade on. For this example, we will put EURUSD into the "symbol" field, so that OP looks for an open EURUSD trade in the terminal. 


3) OP identifies the open EURUSD buy trade (Trade A), and places a pending order in the opposite direction (Trade B) with an entry price at X% of the SL level of Trade A. For example, if the entry price setting is 0.65, then the entry price of Trade B would be at 65% of the distance between the entry price for Trade A (1.10000) and the SL for Trade A (1.00000). So in this example, the entry price of Trade B (EURUSD sell trade) would be 1.06500.


4) The order for Trade B is automatically canceled if it is not yet filled by the time Trade A is closed. In other words, the closure of Trade A causes the cancellation of the pending order for Trade B.


5) in the settings for OP, the user can customize the Volume, SL, TP, and Trailing Stop on Profit for Trade B


What I need modified, your key actions highlighted in bold:


1) When OP gets a signal to open an order, I am getting the following error: “invalid pointer access in ‘OP.MT5’ (128,16)”. The pending order fails to open, and OP removes itself from the chart it is attached to. Fix this error so that the order for Trade B is always successfully placed.


2) Limit the maximum number of Trade B orders to one per each Trade A

Continuing on the previous example, if I set the entry price percentage for Trade B at 0.4, OP will place a pending order for EURUSD sell at 1.04000. The user has set the SL and TP for Trade B at 4000 points (1.08000) and 4000 points (1.00000), respectively. If Trade B is filled, and then the price goes up to 1.08000, it hits SL and Trade B is closes. But then another pending order is placed with entry price of 1.04000, because Trade A is still open (until it hits its own SL or TP of 1.00000 or 1.20000), and OP is still looking to open a new Trade B based on any existing trade that fits the linkage (symbol EURUSD). So if the price goes up to 1.08000, hits Trade B SL, and then quickly goes back down to 1.04000, without ever touching the SL or TP for Trade A, then another Trade B is opened at the price of 1.04000.

This means that one Trade A can have multiple Trade Bs, which is not good. The code should be fixed such that for each Trade A, there is maximum one deal for Trade B, until Trade A is closed.


3) Ensure that a Trade B is filled even if Trade A opens and closes in a loss very quickly 

For example, if Trade A has a tight SL or if market movements are very strong and fast, Trade A can open and close in a loss in 1 second or less, not giving enough time for the pending order for Trade B to be opened and filled before being cancelled due to Trade A being closed. I believe the way the logic is now, the pending order for Trade B is automatically closed if it is not filled by the time Trade A is closed, regardless of whether Trade A closed in profit or in loss. The code should be fixed such that the pending order for Trade B is only cancelled if Trade A closes in profit.

And sometimes the issue may be that OP does not have enough time to place the pending order for Trade B by the time Trade A closes (due to slow server speeds, etc.) The code should ensure that there is always a filled order for Trade B if Trade A hits SL and closes in loss. This may require adding a “safety net” in the code so that if Trade A closes in loss before the pending order for Trade B can be placed, OP will immediately open a market order instead. The priority is to always open Trade B with pending orders, but in the rare cases that fails due to extremely fast Trade A closure, only then should a market order be used to open Trade B.


4) Ensure that once Trade B is filled, it is no longer affected by Trade A. Review the code to ensure that any actions with Trade A have no impact on Trade B once Trade B is already filled.


5) Ensure that the SL and TP of Trade B are modified based on the actual fill price after slippage. For example, if the entry price for Trade B is 1.04000 but it actually fills at 1.03800 due to slippage, ensure that the SL and TP are adjusted to be based on the actual fill price. So if the user settings for Trade B’s SL and TP are 1000 points, then the SL and TP of Trade B should be 1.04800 and 1.02800 instead of 1.05000 and 1.03000, because even though the pending order had an entry price of 1.04000, the actual fill price after slippage was 1.03800.


6) Add option to determine the lot volume of Trade B based on a percentage of the lot volume of Trade A. Insert code that will create a user input to calculate Trade B lot volume as a percentage of the lot volume of Trade A (for example 0.10 for 10%, 2.00 for 200%, 3.55 for 355%). So if the user setting for this 1.5, and Trade A has a volume 0.1 lots, then Trade B will have a volume of 0.15 lots. The code should ensure that Trade B lot is rounded up to the broker minimum lot. This input should only be active if the user input for fixed lot volume is 0.


7) Overall review of the code to identify and fix errors and optimize the speed of execution.


Файлы:

ZIP
OP.zip
2.3 Kb

Откликнулись

1
Разработчик 1
Оценка
(8)
Проекты
11
0%
Арбитраж
6
33% / 67%
Просрочено
2
18%
Свободен
2
Разработчик 2
Оценка
(43)
Проекты
62
23%
Арбитраж
8
25% / 25%
Просрочено
10
16%
Загружен
3
Разработчик 3
Оценка
(3)
Проекты
4
0%
Арбитраж
2
0% / 100%
Просрочено
1
25%
Свободен
4
Разработчик 4
Оценка
(7)
Проекты
12
8%
Арбитраж
3
0% / 67%
Просрочено
4
33%
Свободен
5
Разработчик 5
Оценка
(16)
Проекты
35
23%
Арбитраж
4
0% / 50%
Просрочено
2
6%
Работает
6
Разработчик 6
Оценка
(574)
Проекты
945
47%
Арбитраж
309
58% / 27%
Просрочено
125
13%
Свободен
Похожие заказы
I need an Expert Advisor for MetaTrader 5 (MQL5) to trade XAUUSD based on a simple price movement cycle. Strategy logic: • The EA opens a Buy and a Sell at the same time (one pair per cycle). • Only ONE Sell position must exist at any time. • Every Buy must be opened together with a Sell. Cycle rules: • Step movement = 10 USD in gold price. • CycleEntryPrice = the OPEN PRICE of the last cycle BUY order. • If price
I am looking for a professional MQL5 developer to build a MetaTrader 5 Expert Advisor from scratch. The EA will be called LadyKiller EA. It must trade only the following instruments: • XAUUSD (Gold) • US30 / Dow Jones Index Requirements: • Strong and reliable buy and sell entry logic • Stop Loss and Take Profit system • Risk management (lot size control) • Maximum trades protection • Drawdown protection • Trend
I need an mql5 EA which can be used with 100$ capital very low drawdown The EA should be high frequency trading special for XAUUSD and btcusd or binary options but also the EA should be testable via strategy tester and demo test for five days is needed NO SELECTION CAN BE DONE WITHOUT TESTING when applying make sure you send the backtester results with demo EA testable via strategy tester
I currently have a powerful and well-structured Expert Advisor available on the MT5 platform. This EA is designed with: ✅ Advanced entry and exit logic ✅ Smart risk management system ✅ Automatic lot sizing option ✅ Break-even and trailing stop protection ✅ Spread and session filters ✅ Drawdown control features ✅ Optimized for XAUUSD and scalping strategies ✅ Suitable for prop firm challenges like FTMO It is built for
Do you need a profitable and well-structured trading strategy converted into a fully automated Expert Advisor on the MT5 platform? I specialize in developing advanced, high-performance EAs with: ✅ Smart entry & exit logic ✅ Risk-based lot size calculation ✅ Break-even & trailing stop system ✅ Spread & session filters ✅ Daily drawdown protection ✅ Prop firm (FTMO-style) risk compliance ✅ Fully automated trade
Hello, I'm looking to find out the cost of creating a mobile trading robot. I've tried to describe it as thoroughly as possible in the following document. I look forward to your response. I'd like to know the costs, delivery time, and how you plan to implement it before making a decision
I am offering a ready-to-use trading system that connects MetaTrader 4 signals with automated trading on Polymarket. The system is already fully developed and working. What the system does: The bot copies signals from a custom MT4 indicator and executes trades automatically on Polymarket prediction markets. How it works: A custom MT4 indicator generates BUY or SELL signals using buffers. When a signal appears, it is
DO NOT RESPOND TO WORK WITH ANY AI. ( I CAN ALSO DO THAT ) NEED REAL DEVELOPING SKILL Hedge Add-On Rules for Existing EA Core Idea SL becomes hypothetical (virtual) for the initial basket and for the hedge basket . When price hits the virtual SL level , EA does not close the losing trades. Instead, EA opens one hedge basket in the opposite direction. Original basket direction Hedge basket direction (opposite) Inputs
Billionflow 30 - 100 USD
Trading specifications: Indicators: Bollinger band ( Period 40, Deviation 1 apply to close) Moving Average (Exponential ) Period 17 applied to high Moving Average ( Exponential ) Period 17 applied to low But Signal enter a buy trade when prices crosses the lower band of the bollinger band up and also crosses the moving average channel of high and low the reverse is true for sell signal
Hello, I am a user of the "BUY STOP SELL STOP V6" trading bot, which is an advanced Grid System bot. The bot is primarily designed for Gold (XAUUSD), but I want it to work on all currency pairs. "The bot contains a privacy/protection code that prevents it from running on other accounts or being modified on any platform, as it has a client account number lock mechanism" --- Bot Description & Current Settings Bot Type

Информация о проекте

Бюджет
30+ USD
Сроки выполнения
до 4 дн.