Spécifications
Hello developers,
I’m looking for a skilled MQL5 coder to build a fully functional Expert Advisor based on my strategy. The logic involves grid-based order management (both negative and positive grids), flexible entry by indicators, trailing stop, breakeven, and strict drawdown protection.
Key highlights:
-
Initial entry based on combined indicator signals (RSI, MA, Stochastic, ADX, Momentum – all fully configurable).
-
Subsequent orders are opened by logic: average-down if losing, stacking if in profit.
-
Lots can be fixed or calculated by multiplier after first order.
-
TP/SL calculated based on average price per cycle (not per order).
-
Drawdown-based safety to close losing cycles.
-
Fully adjustable inputs.
-
Informative GUI (panel) – no buttons, just display.
-
Must include full source code, clean and well-commented.
-
Flowchart and full requirements provided as below or in attached file
If you are reliable, experienced, and deliver quality code with good structure, we can also collaborate long term for upgrades.
Looking forward to your proposals.
----
Description:
Trading EA – Detailed Specification
⚙️ Overview This EA is a fully customizable expert advisor designed for automated trading with smart position management, flexible indicator signals, and safety-focused logic.
The EA includes the following major components:
-
General trading settings: trade direction, magic number, comment, trading hours, Friday auto-close.
-
Lot management: initial lot logic, step-multiplier for subsequent orders, and max lot limit.
-
Profit & loss control: average-based TP/SL, visible/invisible levels, trailing stop, breakeven options.
-
Safety settings: max drawdown per order and per cycle.
-
Grid logic: negative grid (for loss), positive grid (for stacking profit), or both.
-
Indicator signals: signal-based opening using customizable technical indicators.
-
Flexible multi-timeframe support for indicators.
-
Graphical user interface (GUI) to monitor key metrics (no buttons).
-
Source code must be provided for future modifications.
🧠 Strategy Logic
-
Start with 1 initial trade triggered by a group of indicator signals.
-
If the trade is in loss, new orders are opened to average down the position (negative grid).
-
If the trade is in profit, additional orders are opened to stack profit (positive grid).
-
Each cycle of trades (BUY or SELL side) is managed with TP/SL calculated from average price.
-
TP/SL/Trailing/Breakeven are applied at cycle level, not individual orders.
-
Orders are only opened within allowed trading hours.
🎛️ Input Parameters Trade Direction & General
-
Enable BUY / SELL: toggle trading direction.
-
EA Magic Number: default 666666
-
EA Comment: default "Autotrading"
-
Enable Trading Hour Restriction: true/false
-
Start Hour/Minute
-
End Hour/Minute
-
Close all orders after trading hour: true/false
-
Close all orders on Friday: true/false
-
Friday close hour/minute
-
-
Order & Cycle Management
-
Max orders per magic/pair
-
Max orders per side (BUY or SELL)
Initial Lot Logic
-
Initial Lot Type:
-
manual_initial_lot: fixed lot size.
-
balance_per_initial_lot: lot size = (balance / balance_per_initial_lot) * initial lot
-
Ex: 0.01 lot * (550 / 100) = 0.055 → rounded to 0.06
-
-
-
Initial Lot: used only for the first order
-
Balance Per Initial Lot: required if using auto lot calculation
Subsequent Lot Calculation
-
Lot Calculation Mode:
-
Fixed: all grid orders use same as initial lot.
-
Multiplier: each new grid order uses Lot_previous * Lot Multiplier
-
-
Lot Multiplier: default = 1.0
-
Maximum Lot Size: cap lot size per order
TP & SL Logic (Average Based)
-
TP and SL are applied to average entry price of all orders in a cycle.
-
Visible TP/SL (set directly on each order): in points, 0 = off
-
Invisible TP/SL (handled by EA logic only): in points, 0 = off
Trailing & Breakeven
-
Trailing Start (in points)
-
Trailing Distance (in points)
-
Breakeven TP Trigger: number of orders needed to trigger breakeven TP
-
Breakeven SL Trigger: number of orders needed to trigger breakeven SL
Safety Settings
-
Max Drawdown per Order (% of balance): 0 = off
-
Max Drawdown per Cycle (% of balance): 0 = off
-
If breached, all orders of that direction (BUY or SELL) are closed. EA continues monitoring and may open new trades after.
-
Grid Settings
-
Grid Type: choose from:
-
Negative Only (average down)
-
Positive Only (stack profit)
-
Both
-
-
Grid Distance (negative): in points
-
Grid Distance (positive): in points
-
Only Open Additional Orders With Signal: true/false
📊 Indicator Signal Settings To open the first order of a new cycle, all selected indicators must give the same signal (BUY or SELL). Indicator signals also affect whether grid orders can be added if only open with signal = true. If no indicator is enabled, signal is always considered true.
RSI
-
Enable RSI
-
Timeframe
-
Period
-
Applied price: close
-
Bar to use: current bar
-
Buy signal types:
-
Above value
-
Below value
-
Cross above value
-
Cross below value
-
-
Sell signal types: same as above
-
Value: set threshold
Moving Averages (2 MA system)
-
Enable MA
-
MA1 & MA2
-
Timeframe, Period, Shift = 0, Method (SMA/EMA), Applied price = close
-
-
Buy signals:
-
Price above/below MA1/MA2
-
Price above/below both MAs
-
MA1 cross above MA2
-
-
Sell signals: same structure
Stochastic
-
Enable
-
Timeframe, K, D, Method = simple
-
Applied price: low/high
-
Bar: current
-
Buy/Sell condition: above or below threshold
ADX
-
Enable
-
Timeframe, Period, Entry bar: current
-
Buy/Sell: above/below value
Momentum
-
Enable
-
Timeframe, Period, Entry bar: current
-
Buy/Sell:
-
Above value
-
Below value
-
Cross up/down value
-
-
Value: set threshold
🖥️ User Interface (GUI) EA should include an on-screen panel displaying key information (no interaction required):
Information Panel:
-
EA name & version
-
Account balance & equity
-
Current symbol and timeframe
-
Number of open orders (Buy/Sell)
-
Current cycle type (Buy/Sell/None)
-
Total lot size
-
Average price of open cycle
-
TP, SL (avg), floating PnL
🧪 Additional Requirements for Testing & Debugging
-
Source code must be included for future upgrades.
-
All logics and triggers should have Print() debug messages for testing.
-
Orders must use MagicNumber properly so multiple instances do not interfere.
-
Allow OnInit() to print parameter summary when EA starts.
-
Add a Test Mode = true/false input to simulate signals manually.
🔄 Operational Flowchart
flowchart TD A[Start EA] --> B{Trading Hours OK?} B -- No --> Z[Wait for next tick] B -- Yes --> C{Any Signal for BUY or SELL?} C -- No --> Z C -- Yes --> D[Open initial trade with initial lot] D --> E{Trade in profit?} E -- Yes --> F{Positive grid enabled?} F -- Yes --> G[Open new order with calculated lot & distance] F -- No --> H[Hold position until TP or SL] E -- No --> I{Negative grid enabled?} I -- Yes --> J[Open new order with calculated lot & distance] I -- No --> H G & J --> K{TP / SL / Breakeven hit?} K -- Yes --> L[Close all orders in cycle] L --> Z K -- No --> Z
-