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%
空闲
相似订单
Expert Advisor 30 - 2000 USD
Necesito un Expert Advisor simple para MT4 basado en una estrategia de scalping con sistema grid/martingala. 1. Lógica General El EA debe abrir una operación inicial (con opción de seleccionar dirección manual: Comprar / Vender / Ambas). Si la operación entra en drawdown, debe abrir posiciones adicionales basadas en una distancia fija en pips (pip step). Cada nueva posición debe aumentar el tamaño del lote según un
I need an EA 30+ USD
I need an EA that is performing well. I am interested in purchasing it, but only genuine sellers should reply. It must have verified live performance and past trading history
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
I need Ea that executes trade based on trading view indicator called Market Structure CHoCH/BOS (Fractal) [LuxAlgo] I need developer to recreate the indicator as an Ea in MQL5 The core of the system will be a structured Market Structure engine that detects CHOCH (Change of Character) and BOS (Break of Structure) Signals will be confirmed once the indicator gave ( the bos/choch) no need to wait candle close
Looking to purchase a Good forex or gold/ BTC trading EA and it's source code. Must be compatible with low budget like less than $500 accounts, Must need no manual intervention and run fully automated. If you are interested in selling me the source code, please share the Read only account access where the EA has already been running on, so i can check past performance and get an idea on how it works or runs. Dont
Hello, I’m looking for an experienced MQL4/MQL5 developer to work with me on an ongoing basis. My clients request services such as: Converting TradingView Pine Script indicators/strategies into MT4 or MT5 Expert Advisors Converting MT4 EAs to MT5 (and MT5 to MT4) Compiling and fixing existing MQL4 / MQL5 EA code Adding simple features like alerts, SL/TP, lot size, and basic money management This job is for

项目信息

预算
30+ USD
截止日期
 4 天