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%
類似した注文
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 have an existing MT5 Expert Advisor (“E-Core”). I need an experienced MQL5 developer to integrate a structured risk management upgrade and a higher timeframe trend filter into the current code. Two files will be provided: 1️⃣ E-Core Source Code (Current Version) 2️⃣ Update Instructions File (contains exact inputs, functions, and logic to integrate) The developer must: Integrate the update logic
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 am looking for a highly experienced Pine Script v5 developer to build a professional, non repaint price action indicator for TradingView. or a ready made one so i can purchase. This is a structured two phase project. The goal is to create a clean, intelligent price action tool that works for both fast intraday trading and swing trading. Only apply if you have strong Pine experience and understand liquidity
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
I am looking someone to create an EA based on my MACD Histo indicator / strategy from Pinescript. I will send it to you for you to replicate. The EA shall have: - Divergence length in bars, min and max values. - Pivot Logic - Entry on close of divergence confirmation bar. - Dynamic lot size dependent on SL/TP, in monetary value. - SL / TP in percent away from entry, separate values for long and short. - Time, day and
Hello, I have a breakout EA with reversal logic. I own the full source code for both MT4 and MT5 versions. I need the modifications implemented for both MT4 and MT5 versions. I need several modifications: – Multiple reversals with configurable parameters – Breakeven functionality – Entry only after candle close beyond range + offset – Time-based activation – Alternative offset calculation logic – Automatic close at
simple automated trading system with adaptive risk management and trend-based execution. The EA manages trades with dynamic position handling and built-in stability filters. Designed for single-position trading and disciplined execution 30 usd budget

プロジェクト情報

予算
30+ USD
締め切り
最高 4 日