작업 종료됨
명시
I have an Expert Advisor (EA) already operating on MetaTrader 5, and I would like you to implement some specific modifications. Below, I describe how the EA currently works, followed by the exact instructions that need to be implemented to achieve the desired behavior.
1. Current Functionality of the EA (HARD10 Base)
-
The EA opens a buy or sell trade on initialization, depending on the parameter OperarEnVenta ( true = sell, false = buy).
-
The trade opens with a LoteInicial (initial lot size), and SL/TP values in pips, all defined via inputs.
-
If the trade closes by Stop Loss (SL):
-
The lot size is multiplied by MultiplicadorLotes for the next trade.
-
A counter of consecutive SLs is incremented.
-
If the maximum number of consecutive SLs ( MaximosSLseguidos ) is reached, the EA stops trading.
-
-
If the trade closes by Take Profit (TP):
-
The lot size resets to the initial value.
-
The SL counter resets.
-
If DetenerTrasTP = true , the EA stops trading.
-
-
If the trade is closed manually:
-
The lot size and counters reset as well.
-
-
The EA uses a MagicNumber to filter only its own trades.
-
All this logic runs independently on each chart/symbol where the EA is attached.
2. Requested Modifications
a) Activation by Hour and Minute
I want the EA to remain inactive for opening new trades until a user-defined hour and minute is reached. However, it must still detect closed trades before that time in order to maintain synchronized logic across symbols.
Inputs to add:
-
If ActivarHoraDeInicio = true , the EA must wait until the specified time to begin opening trades.
-
Before activation, it must still:
-
Monitor closed trades,
-
Update the SL counter,
-
And adjust lot size or SL/TP values accordingly.
-
-
If the EA is loaded after that time, it should activate immediately.
b) SL/TP Expansion After Consecutive Losses
I would like a feature that increases the SL and TP size after a specified number of consecutive losing trades.
Inputs to add:
-
If ActivarSLTPExpandido = true and the EA accumulates SLsAntesDeExpandir or more consecutive losses:
-
The next trade must use an SL and TP multiplied by FactorSLTPExpandido .
-
-
If a TP is reached or the trade is closed manually:
-
The lot size, SL, and TP return to normal values.
-
c) Shared State Across Multiple Charts
Currently, if the EA is attached to two different charts (e.g., EURUSD and XAUUSD), each instance operates independently. I want to change that.
Objective: All instances of the EA (even on different symbols) must share the same progression logic and multiplier.
Example:
-
On the EURUSD chart, the EA has executed 3 consecutive SLs, increasing the lot size.
-
On the XAUUSD chart, the EA is waiting for its scheduled activation time.
-
Once the EA activates on XAUUSD, it should:
-
Detect that previous SLs occurred in another symbol,
-
And resume the logic using the correct lot size and SL/TP multiplier.
-
Technical notes:
-
You can use global variables, files, or any clean and robust method to share this state.
-
It’s essential that each EA instance knows the current global progression state before executing any trade.
3. General Requirements
-
Deliver clean, efficient code that compiles without errors.
-
Final delivery must include the .mq5 source file.
-
If any request is not feasible exactly as described, I’m open to your technical suggestions.