Spécifications
📌 MQL5 Expert Advisor –Project Specification mt5
Pivot‑Based Single‑Trade EA (H1 / H4)
Name of the Ea : PP H4
1. Project Objective
Develop a simple, deterministic MQL5 Expert Advisor designed to:
- Execute a single structured trade
- Use H1 price behavior with H4 Pivot Point (PP H4) as the core reference
- Apply fixed monetary risk
- Allow an adjustable Risk:Reward Take Profit
- Partially take profit at RR 1:1 (50%)
- Stop trading completely after the first trade, regardless of outcome
- Display the PP H4 visually on the chart
The EA is not adaptive, not predictive, and not self‑optimizing.
2. Market & Timeframe
- Execution timeframe: H1
- Reference timeframe: H4
- EA attached to: H1 chart only
No multi‑symbol or multi‑EA logic is required.
3. Pivot Point Calculation & Visual Display
✅ Pivot Definition (H4)
The EA must calculate the standard H4 Pivot Point using the last fully closed H4 candle:
PP_H4 = (High + Low + Close) / 3
✅ Visual Indicator Requirement
- The PP H4 must be plotted visibly on the chart
- The line must:
- Be clearly distinguishable
- Update only after a new H4 candle closes
- Optional: display label “PP H4”
This visual element is mandatory, as the EA is designed to be used alongside discretionary review.
4. Trading Modes (Manual Selection)
The EA operates in one directional mode at a time, defined by input:
- Bullish Mode
- Bearish Mode
The EA never switches modes automatically.
5. Entry Logic
🔵 Bullish Mode (BUY LIMIT)
- H1 price closes above PP H4
- Price then retraces back to PP H4
- A BUY LIMIT is placed at PP H4
🔴 Bearish Mode (SELL LIMIT)
- H1 price closes below PP H4
- Price then retraces back to PP H4
- A SELL LIMIT is placed at PP H4
6. Stop Loss Logic (Structure‑Based)
- Stop Loss location:
→ The most recent previous PP H4 - Is the last h4 pivot is too close,we must be able to add minimum number of point for the stop loss
Rationale:
This level represents structural invalidation, not volatility noise.
Once placed:
- The SL is never moved
- No breakeven
- No trailing stop
7. Position Sizing (Fixed Monetary Risk)
- Risk is defined as a fixed monetary amount, e.g.:
RiskAmountUSD = 80$
The EA must:
- Calculate lot size so that:
- Maximum loss = $80 if Stop Loss is hit
- Automatically adjust lot size based on:
- Stop distance
- Contract size
- Tick value
No percentage‑based risk, no equity scaling.
8. Take Profit Logic (Adjustable Risk:Reward)
✅ Partial Take Profit (Mandatory)
- At RR = 1:1 (distance equals Stop Loss distance):
- Close 50% of the position