Tâche terminée
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Spécifications
Briefly, the EA looks to see if a certain candle closes higher or lower than the open at a specific time and is higher or lower than a moving average.
If this is the case, we place two limit orders at a certain retracement of the signal candle with the same stop, a fixed target and a trail on a moving average.
Limit orders are valid until the end of the day. If possible
I would like the programmer to incorporate his lines of code into my template so that I can properly navigate the source code.
The bot should have a bool that will allow me to choose if I want to use ATR or fixed percentages for my targets and stops. (I already have the code for the ATR in my template) As well as a bool fix lot size for optimization.
Conditions for a long:
If the candle close following the open (03:00) > the open && the candle close following the open > the 24 EMA place two buy limit orders at a -25% retracement of the signal candle (the candle following the open) with 50% of the total risk of 1% on each position. P1 & P2 will have the same stop (-2%). P1 will have a +2% target. When P1's TP is hit, P2 trails on the 12 EMA. Limit orders are valid for 22 hours.
Conditions for shorts: If the close of the candle following the open (03:00) < than the open && the close of the candle following the open is more < than the 24 EMA place two sell limit orders at a retracement of +25% of the candle of the signal (the candle following the open) with 50% of the total risk of 1% on each of the positions. P1 & P2 will have the same stop (+2%). P1 will have a target of -2%. When P1's TP is hit, P2 trails on the 12 EMA. Limit orders are valid for 22 hours.
Do not open other positions in the same direction as long as there is still a position in the market.
If possible create the open line that spans 24 hours with history/lookback.
Make sure the EA works for all brokers.
inputs:
input bool fixlotsize = true;
input double fixlotsize_val = 0.01;
input double TotalRiskPercentage = 1.00;
input double p1risk = 50;
input double p2risk = 50;
input double stops = 2; //in % input double
input double tp= 2; //in %
input bool atrTargetStop = false;
input double ATRmultiplierForStops = 3;
input double ATRmultiplierForTP1 = 3;
input int trail_MAperiod = 12;
input ENUM_MA_METHOD trail_MAmethod = MODE_EMA;
input ENUM_APPLIED_PRICE trail_MA_AppliedPrice = PRICE_CLOSE;
input int MAperiod = 24;
input ENUM_MA_METHOD MAmethod = MODE_EMA;
input ENUM_APPLIED_PRICE MA_AppliedPrice = PRICE_CLOSE;
input string open_time = "03:00";
input double retracement= 25; //in percennt