Termos de Referência
Platform: MetaQuotes MetaTrader 5
Language: MQL5
Timeframe: H1 (hard-coded default, but parameterized)
Default Symbol: EURUSD (must support any symbol)
Execution Mode: Market Execution
2️⃣ CORE PHILOSOPHY
System optimized for:
-
Capturing expansion after pullback
-
Maximizing R multiple
-
Allowing volatility-based scaling
-
static datetime lastBarTime;
if(Time[0] != lastBarTime)
{
lastBarTime = Time[0];
// Execute logic
} moderate-to-high drawdown
No:static static datetime lastBarTime;
if(Time[0] != lastBarTime)
{
lastBarTime = Time[0];
// Execute logic
} lastBarTime;
if(Time[0] != lastBarTime)
{
lastBarTime = Time[0];
// Execute logic
}
-
Martingale
-
Grid
-
Hedging
3️⃣ INPUT PARAMETERS
🔹 Trend
-
EMA_Trend_Period = 200
-
EMA_Pullback_Period = 20
🔹 Risk
-
Risk_Percent = 0.5
-
Max_Open_Trades = 2
-
Max_Trades_Per_Candle = 1
🔹 Stop Loss Mode
Enum:
-
SL_FRACTAL
-
SL_LOOKBACK
Parameters:
-
Lookback_Candles = 5
🔹 Take Profit Mode
Enum:
-
TP_FIXED_RR
-
TP_TRAILING_R
Parameters:
-
RR_Ratio = 2.0
-
Trailing_Activation_R = 1.5
🔹 Volatility Filter (NEW – Required for Return Maximization)
-
ATR_Period = 14
-
Min_ATR_Value = dynamic or fixed
-
ATR_Multiplier_SL = 1.0 (optional override)
🔹 Spread Filter
-
Max_Spread_Points
🔹 Session Filter
-
Session_Start = 08:00
-
Session_End = 17:00
-
Session_Timezone = CET
-
Must auto-adjust DST
🔹 Slippage
-
Max_Slippage_Points
🔹 Magic Number
-
Magic_Number
4️⃣ TREND FILTER LOGIC
BUY allowed if:
Close[1] > EMA200
SELL allowed if:
Close[1] < EMA200
EMA calculated on close price.
No intra-candle calculation.
Signal evaluated only on new bar.
5️⃣ ENTRY LOGIC
BUY CONDITIONS:
-
Trend bullish
-
Candle[1] touches or closes below EMA20
(Low[1] <= EMA20 OR Close[1] <= EMA20) -
Candle[0] closes above High[1]
-
Trade executed at open of next candle
SELL = mirror logic.
6️⃣ NEW BAR DETECTION (MANDATORY)
Trade logic must execute only once per candle:
Use static datetime: