Modify EA in MQL5 Language - Add an AutoCalculate Recovery Trade Size Based On Given Formulas

Job finished

Execution time 3 days
Feedback from employee
The BEST client I've worked with so far. Very straightforward, deliberate, and kind.
Feedback from customer
I am lucky to have found such a brilliant well spoken and humble developer. Jacobie, I only want to work with you from here on.

Specification

Current workings:
I have an MQL5 Expert Advisor for MT5 platform that triggers a market buy order when I press Shift b and triggers a market sell order when I press Shift s. The trade size is taken from the settings, and there can be a maximum of 10 trades given in the settings section.

After the order is triggered, it looks at the entry price, adds 50 points as take profit and feeds it into the order.

It does not use stop loss and has martingale style trades instead.

The first active order is a Main Trade (MT) and any second active order is called a Counter Trade (CT)

Option 1 - CT order hits take profit and makes $100 in profit. IF the MT order is in a loss of less than $100, EA closes the MT trade completely.

Option 2 - CT order hits take profit and makes $100 in profit. IF the MT order is in a loss of more than $100, EA closes some lots of the MT order up to $100 but never more.

 

EA can also select which active loss making order to adjust from the settings.
ALL THIS is working fine.
=============================

I need you to add an option that makes the EA AutoCalculate the correct CT trade size, instead of me manually guessing it every time.

Settings Will Have:
Input AutoCalculate CT Size                = True/False;                      (If True then…)

Input AutoCalculate CT TP                   = 50;                                  (Take Profit Points To Be Entered)

Input AutoCalculate CT Minimum Margin               = 10.00;             (Minimum Dollar Margin)

 

IF MT order is BUY & CT is SELL Order - AutoCalculate CT Size =

IF MT is BUY && CT is SELL

MT Buy Entry Price

       3,525.00

CT Sell Entry Price

       3,519.00

MT TP

                     50

CT TP

                     50

MT Buy Exit Price

       3,525.50

CT Sell Exit Price

       3,518.50

CT Minimum Margin

              10.00

 

(CT Margin - ((ENTRY price of Trade to Adjust-EXIT price of CT)*(0.10*100)))/ CT Take Profit

 

For example:
10+((3525.00-3518.50)*0.10*100)/50

(10 + (+65)) / 50

(10 + 65) / 50

75 / 50

= 1.50 lots


IF MT order is BUY & CT is BUY Order - AutoCalculate CT Size =

MT Buy Entry Price

       3,525.00

CT Buy Entry Price

       3,519.00

MT TP

                     50

CT TP

                     50

MT Buy Exit Price

       3,525.50

CT Buy Exit Price

       3,519.50

CT Minimum Margin

              10.00

 

(CT Margin - ((ENTRY price of Trade to Adjust-EXIT price of CT)*(0.10*100)))/ CT Take Profit

 

For example:

10+((3525.00-3519.50)*0.10*100)/50

(10 + (+55)) / 50

(10 + 55) / 50

65 / 50

= 1.30 lots


IF MT order is SELL & CT is BUY Order - AutoCalculate CT Size =

MT Sell Entry Price

       3,511.00

CT Buy Entry Price

       3,515.00

MT TP

                     50

CT TP

                     50

MT Sell Exit Price

       3,510.50

CT Buy Exit Price

       3,515.50

CT Minimum Margin

              10.00

 

(CT Margin - ((EXIT price of CT - ENTRY price of Trade to Adjust)*(0.10*100)))/ CT Take Profit

 

For example:

(10+((3515.50-3511.00)*0.10*100))/50

(10 + (+45)) / 50

(10 + 45) / 50

55 / 50

= 1.10 lots

 

IF MT order is SELL & CT is SELL Order - AutoCalculate CT Size =

MT Sell Entry Price

       3,511.00

CT Sell Entry Price

       3,515.00

MT TP

                     50

CT TP

                     50

MT Sell Exit Price

       3,510.50

CT Sell Exit Price

       3,514.50

CT Minimum Margin

              10.00

 

(CT Margin - ((EXIT price of CT - ENTRY price of Trade to Adjust)*(0.10*100)))/ CT Take Profit

 

For example:

(10+((3514.50-3511.00)*0.10*100))/50

(10 + (+35)) / 50

(10 + 35) / 50

45 / 50

= 0.90 lots

Important Notes

EA Must Compile correctly at my End. Any Trade folder files must also be submitted.
EA Trade Adjustment on AutoCalculate CT Size = True should be the same as when False
EA Must retain the same magic number and COMMENT after a trade has been adjusted.


Responded

1
Developer 1
Rating
(18)
Projects
22
9%
Arbitration
6
33% / 50%
Overdue
1
5%
Working
2
Developer 2
Rating
(16)
Projects
35
23%
Arbitration
4
0% / 50%
Overdue
2
6%
Working
3
Developer 3
Rating
(39)
Projects
57
18%
Arbitration
6
33% / 17%
Overdue
1
2%
Free
Published: 2 codes
4
Developer 4
Rating
(442)
Projects
570
37%
Arbitration
106
39% / 33%
Overdue
17
3%
Free
5
Developer 5
Rating
(1)
Projects
1
0%
Arbitration
3
0% / 100%
Overdue
0
Free
6
Developer 6
Rating
(504)
Projects
971
74%
Arbitration
27
19% / 67%
Overdue
100
10%
Working
Published: 1 article, 6 codes
7
Developer 7
Rating
(2)
Projects
3
0%
Arbitration
3
0% / 67%
Overdue
0
Working
8
Developer 8
Rating
(2)
Projects
0
0%
Arbitration
5
0% / 60%
Overdue
0
Free
9
Developer 9
Rating
(24)
Projects
30
13%
Arbitration
12
0% / 75%
Overdue
8
27%
Free
Similar orders
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
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
PROJECT DESCRIPTION Looking for 1 experienced MQL5 developer to build 2 Expert Advisors for MetaTrader 5, targeting XAUUSD and major currency pairs. Strong preference for a single developer handling both EAs to maximize code reuse, reduce cost, and ensure consistency. EA1 — Grid Martingale Pro · Buy/Sell grid with Fixed or ATR Dynamic distance (ATR read once per fill, stored in grid_step_at_open[]) · Gap

Project information

Budget
30+ USD
Deadline
to 2 day(s)