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

指定

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.


ファイル:

応答済み

1
開発者 1
評価
(10)
プロジェクト
13
15%
仲裁
0
期限切れ
1
8%
仕事中
2
開発者 2
評価
(15)
プロジェクト
34
24%
仲裁
3
0% / 33%
期限切れ
2
6%
仕事中
3
開発者 3
評価
(31)
プロジェクト
41
15%
仲裁
2
0% / 0%
期限切れ
1
2%
仕事中
パブリッシュした人: 2 codes
4
開発者 4
評価
(438)
プロジェクト
562
37%
仲裁
99
40% / 27%
期限切れ
15
3%
多忙
5
開発者 5
評価
プロジェクト
0
0%
仲裁
1
0% / 0%
期限切れ
0
取り込み中
6
開発者 6
評価
(464)
プロジェクト
912
76%
仲裁
25
16% / 68%
期限切れ
99
11%
取り込み中
パブリッシュした人: 1 article, 6 codes
7
開発者 7
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
仕事中
8
開発者 8
評価
(1)
プロジェクト
0
0%
仲裁
2
0% / 0%
期限切れ
0
取り込み中
9
開発者 9
評価
(10)
プロジェクト
10
10%
仲裁
2
0% / 0%
期限切れ
2
20%
多忙
類似した注文
I am looking for an EA to pass prop firm challenges and use in Funded Account . if you have already built such in the past i can take it The EA has to comply with the following rules: MUST HAVE STOPLOSS Follow Prop Firm rules , Please provide evidence of the EA working & Profitable results Have Proper DD , Profit target etc Let's Get it done this now . NO TIME WASTE ONLY GENUINE SELLER WHO CAN PROVE IT WORKS
I am looking for an EA to pass prop firm challenges and use in Funded Account . (for example NOVA FUNDING, FTMO, MFF, MYFUNDEDFX) and be able to continuously use it on live accounts. Please provide evidence of the EA working & Profitable results. The EA has to comply with the following rules: MUST HAVE STOPLOSS Follow Prop Firm rules , Please provide evidence of the EA working & Profitable results Profit 1-5% min
Hi Programmers, I want to create an EA that will make use of the average prices to determine the direction of the market and take bids accurately towards the direction until it reaches the maximum distance for taking bids. It will also consider a profit to loss ratio which will be based on risk as a % of the account balance. As you can see from the picture and the prices showed , the prices represent the manually
Description: I need an EA for MetaTrader 5 with the following features: On-chart panel for manual trade setup (Entry, TP, SL, Lot Size). EA automatically manages a sequence of additional grid orders once the first order is triggered. EA dynamically adjusts TP/SL levels of active trades when new grid orders are added. Must prevent duplicate order sets. Optional: “Close All Trades” button. Requirements: Proven MQL5
(I had a few horrible experiences here dealing with time and money wasters, SO YOU MUST KNOW WHAT I'M EXACTLY ASKING FOR OR WE GET NOWHERE!!!)Looking for an EA that has been previously tested and can pass prop firm challenges. You will need to demonstrate the EA to showcase its true nature. Please only apply if you have a system ready. This can be a previous job you already did for someone, or have something in the
We have a working price prediction engine for (BTC, ETH, SOL) at fixed 5-minute intervals and want to build a robust backtesting system that evaluates these predictions against MECX futures prices. The goal is to measure baseline directional accuracy and then explore conditional strategies that improve accuracy beyond a 60% milestone. Data Overview Predictions Table (public.price_predictions_5m) One row per asset
HELLO GREAT DEVELOPER I've been playing with a strategy using an already coded Pinescript V5 Indicator, and wanted to turn it in to a strategy with a few additions. (I have incuded the code for the original Indicator) Trading the 1 minute chart I'd like the strategy to go long if the prices passes the higher ORB 50% line while the 3min 20 WMA is above the 3min 200 SMA and the 3 min RSI is below 50. With a Stop loss
PLEASE READ: IF YOU ARE NOT GOING TO ACCEPT THE BELOW THEN PLEASE MOVE ON TO THE NEXT CLIENT. I NEED SOMEONE WHO WILL DO THE WORK FIRST AND THEN CREATE A BUILT-IN DEMO INDI AS PER SPECIFICATIONS BELOW WHICH HAS AN EXPIRY (A DAY OR 2) SO THAT I TEST THE INDI BEFORE WE CREATE THE ORDER. I HAVE HAD PEOPLE WHO PRESSURE ME TO CREATE THE ORDER AND THEN THEY END UP DEVELOPING A FAULTY INDICATOR. AND I HAVE GIVEN THEM THE
Project Overview: We are seeking a highly skilled and experienced developer to build a next-generation Forex Expert Advisor (EA) for MetaTrader 5. The core innovation of this project is an EA that relies 100% on a custom deep learning AI model (e.g., LSTM, Transformer) for generating all trading signals. The EA will trade the XAU/USD (Gold) instrument. The developer must be proficient not only in advanced MQL5
Looking for a reliable, low-lag reversal indicator for Forex that does not repaint and does not place signals with an offset. Key features: Signals only after confirmation (uses closed bar logic), so alerts are final and do not repaint. No offset placement — arrows/markers appear on the same candle/bar that triggered (or on the close of that bar) to avoid confusion. Tunable sensitivity: adjustable lookback and

プロジェクト情報

予算
30+ USD
開発者用
27 USD
締め切り
最高 2 日