Develop MT4/MT5 EA – Advanced Multi-Timeframe Strategy (XAUUSD) – Armani Formula 3.0

Spécifications

The strategy is already fully defined with exact logic, scoring system, entry rules, risk management, and execution protection (spread, slippage, deviation).          The strategy is already fully defined with exact logic, scoring system, entry rules, risk management, and execution protection (spread, slippage, deviation).           Please follow the specification strictly without any discretionary interpretation.      Requirements:
- Clean and modular code (Signal / Risk / Execution / Logging)
- Full logging system
- Proper handling of spread, slippage, and execution quality
- Backtest-ready EA
- Source code included (.mq4 / .mq5)      The full detailed specification is attached below.
Please confirm understanding before starting:
Armani Formula 3.0 – Final Developer Lock Specification
Version: 1.1 Final Coding Definitions
Target Platforms: MT4 / MT5
Primary Symbol: XAUUSD
EA Type: Fully Rule-Based, Non-Discretionary, Multi-Timeframe Execution System
Objective: Convert Armani Formula into a strict programmable Expert Advisor with no subjective chart interpretation.
1) GENERAL STRATEGY PHILOSOPHY
This EA must not trade based on a single indicator signal.
The EA must operate only through a strict multi-timeframe hierarchy:
H4 = Main Directional Bias
H1 = Confirmation Layer
M15 = Entry Trigger Layer
A trade is valid only when:
H4 produces a clear directional bias
H1 confirms the same direction
M15 produces a valid entry trigger
All execution and protection filters pass
Stop loss, lot size, and order execution remain valid at live price
If any one of these fails, the EA must skip the trade.
The EA must always prioritize execution quality over signal quantity.
Missing a trade is acceptable. Bad execution is not acceptable.
2) CORE IMPLEMENTATION RULE
The developer must code this strategy as a deterministic rule engine.
Where chart-reading is usually discretionary, use the closest stable programmable approximation.
No trade may be opened based on “visual interpretation” or subjective pattern reading.
All rules below are final default definitions unless exposed as configurable inputs.
3) TIMEFRAME HIERARCHY AND PROCESS FLOW
On every new M15 candle close, the EA must do the following in order:
Check whether trading is allowed globally
Check symbol and spread/execution conditions
Read H4 bias
Read H1 confirmation
Read M15 trigger
Validate no-trade overrides
Validate stop loss placement
Validate lot sizing and margin
Execute order only if all checks pass
The EA must process logic only once per closed M15 candle unless breakout/retest mode is enabled.
Default execution mode for Version 1.1:
Entry Mode = Market entry on close of valid M15 candle
4) INDICATORS AND DEFAULT SETTINGS
H4
EMA50
MA20 (Simple Moving Average)
RSI(14)
MACD (12,26,9)
Bollinger Bands (20,2)
Market Structure
Optional Fibonacci context only for TP/reference, not mandatory for trade permission
H1
EMA50
MA20
RSI(14)
MACD (12,26,9)
Stochastic (5,3,3)
Bollinger Bands (20,2)
Market Structure / BOS
Support / Resistance reaction
ATR(14)
M15
RSI(14)
MACD (12,26,9)
Stochastic (5,3,3)
Candle confirmation
Trigger level breakout / retest / close
Support / Resistance reaction
ATR(14)
5) SCORE ENGINE OVERVIEW
The EA must calculate:
H4 Bullish Score
H4 Bearish Score
H1 Bullish Score
H1 Bearish Score
Then decide direction by thresholds.
The EA must never mix directions. If bullish and bearish evidence are both strong on the same timeframe, timeframe output = Neutral.
6) H4 MAIN BIAS LOGIC
H4 defines the dominant market direction.
6.1 H4 Bullish Scoring
Add bullish points exactly as follows:
A. Price vs EMA50
If last closed H4 candle close > EMA50 = +2 bullish
B. MA20 Position and Slope
If MA20 > EMA50 = +1 bullish
If MA20 slope is upward = +1 bullish
Definition of MA20 upward slope:
MA20 current value on closed H4 candle > MA20 value 1 bar ago by at least 0.05 x ATR(H4,14) OR simply greater than previous MA20 value for 2 consecutive closed candles.
Use this exact rule:
MA20[1] > MA20[2]
AND MA20[2] >= MA20[3] Then slope = upward.
C. RSI(14)
If RSI > 55 = +1 bullish
If RSI > 60 = +1 additional bullish
D. MACD
If MACD main > signal = +1 bullish
If MACD histogram > 0 = +1 bullish
E. Bollinger
If close > Bollinger middle band = +1 bullish
If upper band expanding upward and price pressing upper side = +1 bullish
Definition of upper band expanding upward and price pressing upward: All must be true:
UpperBand[1] > UpperBand[2]
BandWidth[1] > BandWidth[2]
Close[1] is in upper 35% of Bollinger channel range:
(Close[1] - LowerBand[1]) / (UpperBand[1] - LowerBand[1]) >= 0.65
F. Market Structure
If recent structure shows HH + HL = +2 bullish
If bullish BOS confirmed = +2 bullish
G. Support Reaction
If price recently rejected valid H4 support and closed bullish = +1 bullish
6.2 H4 Bearish Scoring
Add bearish points exactly as follows:
A. Price vs EMA50
If last closed H4 candle close < EMA50 = +2 bearish
B. MA20 Position and Slope
If MA20 < EMA50 = +1 bearish
If MA20 slope is downward = +1 bearish
Definition of MA20 downward slope:
MA20[1] < MA20[2]
AND MA20[2] <= MA20[3]
C. RSI(14)
If RSI < 45 = +1 bearish
If RSI < 40 = +1 additional bearish
D. MACD
If MACD main < signal = +1 bearish
If MACD histogram < 0 = +1 bearish
E. Bollinger
If close < Bollinger middle band = +1 bearish
If lower band expanding downward and price pressing lower side = +1 bearish
Definition of lower band expanding downward and price pressing downward: All must be true:
LowerBand[1] < LowerBand[2]
BandWidth[1] > BandWidth[2]
Close[1] is in lower 35% of Bollinger channel range:
(Close[1] - LowerBand[1]) / (UpperBand[1] - LowerBand[1]) <= 0.35
F. Market Structure
If recent structure shows LH + LL = +2 bearish
If bearish BOS confirmed = +2 bearish
G. Resistance Reaction
If price recently rejected valid H4 resistance and closed bearish = +1 bearish
6.3 H4 Decision Rule
If bullish score >= 7 AND bearish score <= 3 → H4 Bias = Bullish
If bearish score >= 7 AND bullish score <= 3 → H4 Bias = Bearish
Otherwise → H4 Bias = Neutral
6.4 Strict Mode
If strict mode enabled:
H4 threshold = 8 instead of 7
Default:
StrictMode = false
H4MinScore = 7
7) H1 CONFIRMATION LOGIC
H1 confirms whether H4 direction is still valid and tradable.
7.1 H1 Bullish Scoring
Only evaluate bullish side if H4 Bias = Bullish.
Add bullish points:
Price close > EMA50 = +1
MA20 > EMA50 = +1
RSI > 52 = +1
MACD bullish cross or bullish continuation = +1
Stochastic rising from below 50 or crossing upward = +1
Price holding above Bollinger midline = +1
Bullish rejection from support/pullback zone = +2
Bullish BOS or continuation break = +2
ATR confirms move is not weak = +1
7.2 Exact Definitions for H1 Bullish Conditions
MACD bullish cross or continuation
Valid if either:
MACD main crossed above signal within last 2 closed H1 bars OR
MACD main > signal and histogram > histogram previous bar
Stochastic rising from below 50 or crossing upward
Valid if either:
Main stochastic crossed above signal within last 2 bars OR
Both lines rising and main line < 50 then rising upward OR
Main line crossed above 50 within last 2 bars
Price holding above Bollinger midline
Close[1] > MiddleBand[1]
AND low[1] did not close below midline
AND at least 2 of last 3 H1 closes remained above midline
Bullish rejection from support / pullback zone
All must be true:
Price touched valid H1 support zone within last 3 H1 candles
Current or previous candle closed bullish
Lower wick >= 25% of candle range
Close is above midpoint of support zone
Bullish BOS / continuation break
Last closed H1 candle close > last meaningful swing high by at least 0.10 x ATR(H1,14)
ATR confirms move is not weak
ATR(H1,14) >= minimum ATR threshold
Default minimum ATR(H1) for XAUUSD = 2.0 dollars This value must remain configurable.
7.3 H1 Bearish Scoring
Only evaluate bearish side if H4 Bias = Bearish.
Add bearish points:
Price close < EMA50 = +1
MA20 < EMA50 = +1
RSI < 48 = +1
MACD bearish cross or bearish continuation = +1
Stochastic falling from above 50 or crossing downward = +1
Price holding below Bollinger midline = +1
Bearish rejection from resistance/pullback zone = +2
Bearish BOS or continuation break = +2
ATR confirms move is not weak = +1
7.4 Exact Definitions for H1 Bearish Conditions
MACD bearish cross or continuation
Valid if either:
MACD main crossed below signal within last 2 closed H1 bars OR
MACD main < signal and histogram < histogram previous bar
Stochastic falling from above 50 or crossing downward
Valid if either:
Main stochastic crossed below signal within last 2 bars OR
Both lines falling and main line > 50 then dropping OR
Main line crossed below 50 within last 2 bars
Price holding below Bollinger midline
Close[1] < MiddleBand[1]
AND high[1] did not close above midline
AND at least 2 of last 3 H1 closes remained below midline
Bearish rejection from resistance / pullback zone
All must be true:
Price touched valid H1 resistance zone within last 3 H1 candles
Current or previous candle closed bearish
Upper wick >= 25% of candle range
Close is below midpoint of resistance zone
Bearish BOS / continuation break
Last closed H1 candle close < last meaningful swing low by at least 0.10 x ATR(H1,14)
ATR confirms move is not weak
ATR(H1,14) >= minimum ATR threshold
Default minimum ATR(H1) for XAUUSD = 2.0 dollars
7.5 H1 Decision Threshold
For bullish confirmation:
H1 bullish score >= 6
H1 bearish score <= 3
For bearish confirmation:
H1 bearish score >= 6
H1 bullish score <= 3
Otherwise:
H1 = Mixed / Invalid / No Trade
Default:
H1MinScore = 6
8) M15 ENTRY TRIGGER LOGIC
M15 is only a trigger layer.
It must never override H4/H1 alignment.
8.1 M15 Bullish Trigger Conditions
If H4 = Bullish and H1 = Bullish, Buy trigger is valid only if:
At least 4 bullish trigger conditions
Must include at least 1 momentum condition
Must include at least 1 candle / price action condition
Opposite bearish contradiction must not be strong
Momentum Conditions (Bullish)
Count each as 1 if true:
RSI crosses above 50 within last 2 closed M15 candles
RSI rebounds upward from 45–50 zone
MACD bullish cross within last 2 closed candles
MACD histogram turns positive
Stochastic crosses upward
Stochastic exits oversold upward
Price Action Conditions (Bullish)
Count each as 1 if true:
Bullish candle closes above trigger level
Bullish rejection wick from support/retest zone
Break and retest upward confirmed
Candle closes in upper 60% of its own range
Quality Conditions (Mandatory Filters, not counted as score unless desired)
Candle body acceptable
Candle not doji-like
Candle not abnormally oversized
Spread and volatility filters pass
8.2 M15 Bearish Trigger Conditions
If H4 = Bearish and H1 = Bearish, Sell trigger is valid only if:
At least 4 bearish trigger conditions
Must include at least 1 momentum condition
Must include at least 1 candle / price action condition
Opposite bullish contradiction must not be strong
Momentum Conditions (Bearish)
Count each as 1 if true:
RSI crosses below 50 within last 2 closed M15 candles
RSI rejects downward from 50–55 zone
MACD bearish cross within last 2 closed candles
MACD histogram turns negative
Stochastic crosses downward
Stochastic exits overbought downward
Price Action Conditions (Bearish)
Count each as 1 if true:
Bearish candle closes below trigger level
Bearish rejection wick from resistance/retest zone
Break and retest downward confirmed
Candle closes in lower 60% of its own range
Quality Conditions (Mandatory Filters)
Candle body acceptable
Candle not doji-like
Candle not abnormally oversized
Spread and volatility filters pass
9) EXACT DEFINITIONS FOR M15 TRIGGERS
9.1 RSI Rebound Logic
Bullish rebound:
RSI[2] between 45 and 50
RSI[1] > RSI[2]
RSI[1] >= 48
Bearish rejection:
RSI[2] between 50 and 55
RSI[1] < RSI[2]
RSI[1] <= 52
9.2 MACD Histogram Turn
Bullish:
Histogram[1] > 0
Histogram[2] <= 0
Bearish:
Histogram[1] < 0
Histogram[2] >= 0
9.3 Stochastic Exit Zones
Bullish:
Main stochastic crossed above 20 within last 2 bars OR
Main stochastic > signal and both rising from below 25
Bearish:
Main stochastic crossed below 80 within last 2 bars OR
Main stochastic < signal and both falling from above 75
9.4 Trigger Level Definition
For Buy:
Trigger level = highest high of last 3 closed M15 candles excluding signal candle OR nearest local resistance if closer
For Sell:
Trigger level = lowest low of last 3 closed M15 candles excluding signal candle OR nearest local support if closer
Default version: Use whichever is nearer to current price.
9.5 Break and Retest Definition
Bullish break and retest valid if:
Price closed above trigger level
Within next 1–3 candles price retested level
Retest low does not close below level by more than 0.15 x ATR(M15,14)
Rejection closes bullish
Bearish break and retest valid if:
Price closed below trigger level
Within next 1–3 candles price retested level
Retest high does not close above level by more than 0.15 x ATR(M15,14)
Rejection closes bearish
Default entry mode remains:
Market entry on close Breakout/retest mode can be optional.
10) M15 OPPOSITE CONTRADICTION RULE
Even if bullish trigger count is sufficient, bullish trade must be blocked if 2 or more strong bearish contradiction signals exist simultaneously.
Strong bearish contradiction examples on M15:
RSI < 48 after signal
MACD main < signal
Candle closes below support/retest level
Bearish engulfing candle closes immediately after trigger candle
Structure breaks below recent swing low
Likewise for bearish trigger: Block bearish trade if 2 or more strong bullish contradictions exist.
Default:
MaxAllowedOppositeContradictions = 1
2 or more = block trade
11) SWING DETECTION AND MARKET STRUCTURE RULES
11.1 Swing Detection
Use fractal-based swing logic with configurable sensitivity.
Default:
SwingSensitivity = 2 Meaning:
Swing high = a high with at least 2 lower highs on each side
Swing low = a low with at least 2 higher lows on each side
11.2 Meaningful Swing Selection
Use the most recent confirmed swing highs/lows that are not inside a micro-consolidation cluster.
Default:
Ignore swings whose distance from adjacent swing is less than 0.20 x ATR of same timeframe
11.3 Bullish Structure Definition
Bullish structure exists if:
Latest confirmed swing high broken upward
Latest confirmed swing low remains intact
Sequence of higher high and higher low exists across last 2 swing cycles
11.4 Bearish Structure Definition
Bearish structure exists if:
Latest confirmed swing low broken downward
Latest confirmed swing high remains intact
Sequence of lower high and lower low exists across last 2 swing cycles
11.5 BOS Definition
Bullish BOS:
Candle closes above last meaningful swing high by at least 0.10 x ATR
Bearish BOS:
Candle closes below last meaningful swing low by at least 0.10 x ATR
No wick-only break qualifies as BOS.
Close confirmation is mandatory.
12) SUPPORT / RESISTANCE ZONE LOGIC
12.1 Valid Support Zone
A support zone is valid if:
It comes from a recent confirmed swing low
Price reacted there at least once before
A bullish rejection candle formed there
Zone age is not too old
Default zone age:
H4 support usable for up to 30 H4 bars
H1 support usable for up to 20 H1 bars
M15 support usable for up to 12 M15 bars
12.2 Valid Resistance Zone
A resistance zone is valid if:
It comes from a recent confirmed swing high
Price reacted there at least once before
A bearish rejection candle formed there
Zone age is not too old
12.3 Zone Width Definition
Zone width must be based on ATR.
Default:
ZoneHalfWidth = 0.20 x ATR of that timeframe
Full zone = swing point ± ZoneHalfWidth
12.4 Reaction Definition
A bullish reaction exists if:
Candle low enters support zone
Candle closes bullish
Close is above 50% of candle range
Lower wick >= 25% of candle range
A bearish reaction exists if:
Candle high enters resistance zone
Candle closes bearish
Close is below 50% of candle range
Upper wick >= 25% of candle range
13) CANDLE CONFIRMATION RULES
13.1 Bullish Candle Validity
A bullish entry candle is valid only if all are true:
Close > Open
Candle body >= minimum threshold
Not doji-like
Close in upper 60% of range
Opposite wick not extreme if filter enabled
13.2 Bearish Candle Validity
A bearish entry candle is valid only if all are true:
Close < Open
Candle body >= minimum threshold
Not doji-like
Close in lower 60% of range
Opposite wick not extreme if filter enabled
13.3 Exact Candle Body Formula
CandleRange = High - Low
CandleBody = abs(Close - Open)
BodyPercent = CandleBody / CandleRange
Default rules:
Minimum valid body = 35% of total range
Reject candle if body < 25% of total range
Candle is doji-like if body <= 20% of range
13.4 Opposite Wick Filter
For bullish candle:
Upper wick allowed
Lower wick must not exceed 55% of total candle range unless rejection entry specifically enabled
For bearish candle:
Upper wick must not exceed 55% of total range unless rejection entry specifically enabled
13.5 Abnormally Oversized Candle
Reject entry candle if:
Current candle range > 2.2 x average range of previous 10 closed M15 candles
Default:
OversizeMultiplier = 2.2
RangeLookback = 10
14) ATR / VOLATILITY FILTER
ATR is used for both quality and protection.
14.1 M15 Minimum ATR
Trade allowed only if ATR(M15,14) >= 1.2 dollars
14.2 M15 Maximum ATR
Trade blocked if ATR(M15,14) > 8.0 dollars
14.3 H1 Minimum ATR
Confirmation not valid if ATR(H1,14) < 2.0 dollars
14.4 ATR Instability Rule
If ATR(M15,14) > ATR(M15,14 average of last 20 bars) x 2.0, consider environment unstable and skip trade.
14.5 Candle Expansion Filter
Reject signal if:
Current M15 candle range > 2.2 x average of previous 10 M15 candle ranges
15) ENTRY DECISION LOGIC
15.1 BUY allowed only if ALL are true
H4 Bias = Bullish
H4 bullish score >= threshold
H1 bullish score >= threshold
H1 bearish score <= 3
M15 bullish trigger valid
Opposite contradiction not strong
Spread filter passes
Slippage filter passes
Price deviation filter passes
Volatility filter passes
Candle confirmation passes
Stop loss can be safely placed
Lot size valid
Margin sufficient
No duplicate same-signal entry
No conflicting sell trade, unless hedge mode explicitly enabled
15.2 SELL allowed only if ALL are true
Same logic in reverse.
16) ENTRY MODES
The EA must support:
A. Market Entry on Candle Close
Open trade immediately after a valid M15 signal candle closes
B. Breakout Entry
Buy stop above trigger high
Sell stop below trigger low
C. Retest Entry
Wait for retest of broken level
Final Default for Version 1.1
EntryMode = MarketOnClose
If using market entry:
Order must be sent only on new tick after signal candle close
Revalidate spread and price deviation before send
17) SIGNAL EXPIRATION RULE
A valid signal cannot remain active forever.
Default:
Signal valid for maximum 2 M15 candles after detection
If not executed within 2 closed M15 candles, expire signal
If price moved too far before execution, expire immediately
If spread became invalid, expire signal and wait for fresh setup
Parameter:
SignalExpiryBars = 2
18) STOP LOSS RULES
18.1 Buy SL Placement
Compute these candidates:
Recent M15 swing low
Support zone low
Entry candle low
Then:
BaseSL = minimum of these three
Final Buy SL = BaseSL - StructureBuffer
18.2 Sell SL Placement
Compute these candidates:
Recent M15 swing high
Resistance zone high
Entry candle high
Then:
BaseSL = maximum of these three
Final Sell SL = BaseSL + StructureBuffer
18.3 Structure Buffer
Default:
StructureBuffer = 0.20 x ATR(M15,14) Minimum absolute buffer:
0.50 dollars Use greater of the two.
18.4 Stop Loss Validation
Do not trade if:
SL distance < broker minimum stop level
SL distance < 1.0 dollar
SL distance > 15.0 dollars by default
Lot size becomes invalid after SL calculation
Required margin becomes unacceptable
Parameters:
MinSLDistance = 1.0
MaxSLDistance = 15.0
19) TAKE PROFIT RULES
The EA must support:
A. Fixed RR Mode
TP1 = 1R
TP2 = 2R
B. Structure TP Mode
TP based on next H1/H4 resistance for buys
TP based on next H1/H4 support for sells
C. Multi-Target Mode
Partial close at TP1
Final close at TP2 or trailing
Default for Version 1.1
TPMode = MultiTargetFixedRR
TP1 = 1R
TP2 = 2R
PartialCloseAtTP1 = true
PartialClosePercent = 50%
If broker/account type does not support partial close cleanly, developer may use two positions:
Position A = TP1
Position B = TP2
20) BREAK-EVEN RULES
Default break-even logic
When price reaches +1R:
Move SL to entry + BEOffset for buy
Move SL to entry - BEOffset for sell
Default:
BreakEvenEnabled = true
BreakEvenAtR = 1.0
BEOffset = 0.30 dollars or broker-equivalent point value to cover spread/commission
Break-even must trigger only once.
21) TRAILING STOP RULES
Trailing stop is optional and starts only after BE or TP1.
Supported methods:
Fixed points trailing
ATR trailing
Swing trailing
Default mode
Swing + ATR hybrid trailing
For Buy:
Trail below most recent confirmed M15 swing low
Add buffer = 0.15 x ATR(M15,14)
For Sell:
Trail above most recent confirmed M15 swing high
Add buffer = 0.15 x ATR(M15,14)
Trailing starts:
After TP1 hit OR after +1R, whichever comes first
Parameters:
TrailingEnabled = true
TrailingStartAtR = 1.0
22) RISK MANAGEMENT
The EA must support:
22.1 Risk Modes
Fixed lot
Risk % of balance
Risk % of equity
Default
RiskMode = PercentOfEquity
RiskPercent = 1.0%
22.2 Lot Sizing Formula
Lot size must be calculated from:
Account equity
Risk %
SL distance in points
Symbol tick value / contract size
Lot size must then be normalized to broker lot step and min/max lot rules.
22.3 Minimum and Maximum Risk Protections
If calculated lot < broker minimum lot → skip trade
If lot > user-defined max lot → cap or skip based on setting
Default:
SkipIfLotExceedsMax = true
MaxLot = user configurable
23) DUPLICATE SIGNAL PREVENTION
EA must record:
Last processed M15 bar time
Last signal direction
Last signal candle time
Last entry ticket
Whether signal already executed
No second entry may be opened from same signal candle.
Default:
OneTradePerSignal = true
OneTradePerDirection = true
If pyramiding disabled:
No additional buy if buy already open
No additional sell if sell already open
24) OPPOSITE SIGNAL EXIT RULES
Optional feature.
For active Buy:
Close early if any 2 of below occur:
H1 becomes bearish valid
M15 gives strong bearish reversal trigger
Structure breaks below latest protected M15 swing low
For active Sell:
Close early if any 2 of below occur:
H1 becomes bullish valid
M15 gives strong bullish reversal trigger
Structure breaks above latest protected M15 swing high
Default:
OppositeSignalExitEnabled = false
25) NEWS BLACKOUT FILTER
The EA should support a news blackout feature.
Preferred implementation
External economic calendar integration OR
Manual input news windows
Minimum requirement
Allow user to set blackout windows manually:
Start datetime
End datetime
Trade must be blocked during blackout windows.
Default:
NewsFilterEnabled = true
Manual blackout support mandatory
Calendar API support optional if available
Recommended default windows for high impact events:
Block new entries 15 minutes before
Block new entries 15 minutes after
Open trade management may continue, but no new positions.
26) VARIABLE SPREAD FILTER
The EA must assume XAUUSD spread is floating.
26.1 Hard Spread Filter
Parameter:
MaxSpreadPoints
If current spread > MaxSpreadPoints:
Block trade immediately
Log reason
26.2 Recommended Defaults
Because broker digits vary, developer must implement in broker points.
Suggested user-visible presets:
Normal: 20–40 points
High volatility: 60–80 points if enabled
Final default:
NormalMaxSpreadPoints = 40
HighVolatilityMaxSpreadPoints = 70
EnableDynamicSpreadMode = false
The developer must make point conversion safe for symbol digits and broker pricing.
27) DYNAMIC SPREAD MODE
If enabled:
Rule
If ATR(M15,14) <= ATRVolatilityTrigger → use NormalMaxSpreadPoints
If ATR(M15,14) > ATRVolatilityTrigger → use HighVolatilityMaxSpreadPoints
Default:
ATRVolatilityTrigger = 4.0 dollars
High spread must not be automatically accepted unless dynamic spread mode is explicitly enabled.
28) SPREAD STABILITY CHECK
Spread must not be checked once only.
Before execution:
Check spread at signal validation time
Recheck spread immediately before sending order
If spread expands above limit at execution time:
Cancel trade
Optional:
Use last 3 ticks to detect spread spike
Default spike rule:
If current spread > average spread of last 5 ticks x 1.5, treat as unstable and skip
29) SLIPPAGE PROTECTION
Parameter:
MaxSlippagePoints
Orders must not be executed if allowed deviation exceeds configured slippage tolerance.
Default:
MaxSlippagePoints = 20 broker points, configurable
If broker/platform requires deviation parameter only:
Use MaxSlippagePoints converted properly
No “accept any fill” logic allowed.
30) POST-SIGNAL PRICE DEVIATION FILTER
Even after valid signal, EA must confirm live price has not run too far.
Rule
Store intended signal price:
For Buy = close price of signal candle or confirmed execution price basis
For Sell = same logic
Before order send:
Compare live ask/bid with intended signal price
If deviation exceeds allowed buffer:
Cancel trade
Default:
CancelTradeIfPriceRunsAway = true
MaxEntryDeviationPoints = 30 broker points configurable
This is mandatory to prevent chasing.
31) NO-CHASING RULE
If:
Spread widens
Slippage risk increases
Price runs beyond allowed deviation
Signal expires
Then:
Cancel setup completely
Wait for fresh valid signal
Do not enter late from old signal
This rule is mandatory.
32) CONTROLLED RETRY RULE
If order fails due to temporary execution error:
Retry only if:
Spread still valid
Price deviation still valid
Signal not expired
Retry count not exceeded
Default:
MaxRetries = 1
Retry delay minimal
Revalidate all execution conditions before retry
If spread worsens or price moved too far:
No retry
Cancel setup
33) SAFE EXECUTION CONDITIONS
Trade must be skipped if any of the following is true:
H4 neutral
H1 mixed
M15 trigger invalid
Spread too high
Spread unstable
Slippage unacceptable
Price deviation too large
ATR unstable
Candle abnormal
SL invalid
Margin insufficient
Existing same-direction trade exists
Existing same-signal trade exists
News blackout active
Market gap / erratic tick movement detected
Broker rejects execution safety
34) MARGIN AND ACCOUNT SAFETY
Before sending trade, EA must validate:
Free margin sufficient
Lot size valid
Margin after trade remains safe
Optional parameter:
MinFreeMarginPercentAfterTrade = 300% If estimated margin level after entry would be below this threshold, skip trade.
Default:
Enable this protection
35) LOGGING REQUIREMENTS
Logging is mandatory.
Each signal evaluation must record:
Timestamp
Symbol
H4 bullish score
H4 bearish score
H4 final bias
H1 bullish score
H1 bearish score
H1 final validation
M15 bullish trigger count
M15 bearish trigger count
Which conditions were true
Candle quality result
ATR result
Spread at signal time
Spread at execution time
Max allowed spread
Slippage setting
Intended entry price
Live price at execution
Entry deviation points
SL price
TP1 price
TP2 price
Lot size
Risk %
Whether order executed
Exact reason if blocked
Separate mandatory execution logs:
Blocked بسبب spread
Blocked بسبب slippage
Blocked بسبب price deviation
Blocked بسبب signal expiry
Retry cancelled بسبب unstable execution
Trade rejected بسبب invalid stop or volume
36) PARAMETERS TO EXPOSE AS INPUTS
At minimum expose these as user inputs:
General
MagicNumber
EnableBuy
EnableSell
StrictMode
OneTradePerDirection
OneTradePerSignal
Scoring
H4MinScore
H1MinScore
M15MinTriggerCount
MaxAllowedOppositeContradictions
Structure
SwingSensitivity
ZoneATRWidthMultiplier
BOSBreakATRBuffer
Candle
MinBodyPercent
RejectBodyPercent
DojiPercent
UpperClosePercentForBull
LowerClosePercentForBear
OversizeMultiplier
ATR / Volatility
M15MinATR
M15MaxATR
H1MinATR
ATRInstabilityMultiplier
Entry
EntryMode
SignalExpiryBars
CancelTradeIfPriceRunsAway
MaxEntryDeviationPoints
Spread / Slippage
MaxSpreadPoints
EnableDynamicSpreadMode
NormalMaxSpreadPoints
HighVolatilityMaxSpreadPoints
ATRVolatilityTrigger
MaxSlippagePoints
Stop / Profit
MinSLDistance
MaxSLDistance
StructureBufferATRMultiplier
FixedRR1
FixedRR2
PartialCloseEnabled
PartialClosePercent
Break-even / Trailing
BreakEvenEnabled
BreakEvenAtR
BreakEvenOffset
TrailingEnabled
TrailingMode
TrailingStartAtR
Risk
RiskMode
RiskPercent
FixedLot
MaxLot
SkipIfLotExceedsMax
MinFreeMarginPercentAfterTrade
News
NewsFilterEnabled
ManualBlackoutWindows
37) DEFAULT FINAL SETTINGS FOR VERSION 1.1
Use these defaults unless user changes them:
H4MinScore = 7
H1MinScore = 6
M15MinTriggerCount = 4
StrictMode = false
SwingSensitivity = 2
ZoneATRWidthMultiplier = 0.20
BOSBreakATRBuffer = 0.10
MinBodyPercent = 0.35
RejectBodyPercent = 0.25
DojiPercent = 0.20
OversizeMultiplier = 2.20
M15MinATR = 1.2
M15MaxATR = 8.0
H1MinATR = 2.0
ATRInstabilityMultiplier = 2.0
EntryMode = MarketOnClose
SignalExpiryBars = 2
CancelTradeIfPriceRunsAway = true
MaxEntryDeviationPoints = 30
MaxSpreadPoints = 40
EnableDynamicSpreadMode = false
NormalMaxSpreadPoints = 40
HighVolatilityMaxSpreadPoints = 70
ATRVolatilityTrigger = 4.0
MaxSlippagePoints = 20
MinSLDistance = 1.0
MaxSLDistance = 15.0
StructureBufferATRMultiplier = 0.20
FixedRR1 = 1.0
FixedRR2 = 2.0
PartialCloseEnabled = true
PartialClosePercent = 50
BreakEvenEnabled = true
BreakEvenAtR = 1.0
BreakEvenOffset = 0.30
TrailingEnabled = true
TrailingStartAtR = 1.0
OneTradePerDirection = true
OneTradePerSignal = true
RiskMode = PercentOfEquity
RiskPercent = 1.0
SkipIfLotExceedsMax = true
OppositeSignalExitEnabled = false
NewsFilterEnabled = true
38) FINAL BUY MODEL
A BUY is valid only when:
H4 bullish score >= 7 and H4 bearish score <= 3
H4 structure supports bullish bias
H1 bullish score >= 6 and H1 bearish score <= 3
M15 bullish trigger count >= 4
At least 1 bullish momentum condition exists on M15
At least 1 bullish candle/price action condition exists on M15
Candle confirmation passes
Opposite contradictions < 2
Spread valid
Spread stable
Slippage acceptable
Live price deviation acceptable
ATR conditions valid
Signal not expired
No duplicate/conflicting trade
SL valid
Lot size valid
Margin valid
Not in blackout window
Then:
Open Buy
Set SL
Set TP1 = 1R
Set TP2 = 2R
Move to BE at +1R
Apply trailing after +1R or TP1
39) FINAL SELL MODEL
A SELL is valid only when:
H4 bearish score >= 7 and H4 bullish score <= 3
H4 structure supports bearish bias
H1 bearish score >= 6 and H1 bullish score <= 3
M15 bearish trigger count >= 4
At least 1 bearish momentum condition exists on M15
At least 1 bearish candle/price action condition exists on M15
Candle confirmation passes
Opposite contradictions < 2
Spread valid
Spread stable
Slippage acceptable
Live price deviation acceptable
ATR conditions valid
Signal not expired
No duplicate/conflicting trade
SL valid
Lot size valid
Margin valid
Not in blackout window
Then:
Open Sell
Set SL
Set TP1 = 1R
Set TP2 = 2R
Move to BE at +1R
Apply trailing after +1R or TP1
40) FINAL IMPLEMENTATION NOTE TO DEVELOPER
This specification is intended to be coded as a fully rules-based EA.
The developer must not replace any undefined chart-reading with subjective manual interpretation.
If any platform limitation exists between MT4 and MT5, use the closest stable programmable equivalent while preserving the same strategy logic.
Priority order is always:
H4 bias and structure
H1 confirmation
M15 trigger
Candle quality
Execution quality
Risk safety
If H4 and H1 do not align, M15 must be ignored completely.
Execution quality is part of the strategy itself.
A technically valid signal with unsafe spread, slippage, instability, or price deviation is not a valid trade and must be skipped.
Main philosophy:
Trade only when structure, momentum, timing, and execution all align
Do not chase price
Do not trade unstable conditions
Do not overtrade
Prefer missing a trade over entering badly   

Répondu

1
Développeur 1
Évaluation
(60)
Projets
87
29%
Arbitrage
24
13% / 58%
En retard
7
8%
Travail
2
Développeur 2
Évaluation
(13)
Projets
18
11%
Arbitrage
6
33% / 67%
En retard
1
6%
Gratuit
Publié : 1 code
3
Développeur 3
Évaluation
(429)
Projets
629
54%
Arbitrage
32
53% / 22%
En retard
6
1%
Chargé
4
Développeur 4
Évaluation
(1)
Projets
3
0%
Arbitrage
2
50% / 0%
En retard
0
Gratuit
Publié : 2 codes
5
Développeur 5
Évaluation
(75)
Projets
80
6%
Arbitrage
46
11% / 54%
En retard
7
9%
Travail
6
Développeur 6
Évaluation
(16)
Projets
18
6%
Arbitrage
5
20% / 80%
En retard
1
6%
Gratuit
7
Développeur 7
Évaluation
(18)
Projets
26
0%
Arbitrage
4
0% / 100%
En retard
5
19%
Gratuit
8
Développeur 8
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
9
Développeur 9
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
10
Développeur 10
Évaluation
(32)
Projets
33
61%
Arbitrage
1
100% / 0%
En retard
1
3%
Gratuit
Publié : 5 codes
11
Développeur 11
Évaluation
(3)
Projets
4
50%
Arbitrage
0
En retard
0
Gratuit
12
Développeur 12
Évaluation
(1)
Projets
1
0%
Arbitrage
2
0% / 0%
En retard
0
Travail
13
Développeur 13
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
14
Développeur 14
Évaluation
(4)
Projets
4
0%
Arbitrage
4
25% / 75%
En retard
1
25%
Gratuit
15
Développeur 15
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
16
Développeur 16
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
17
Développeur 17
Évaluation
(152)
Projets
228
80%
Arbitrage
22
27% / 50%
En retard
11
5%
Gratuit
Publié : 24 articles, 1882 codes
18
Développeur 18
Évaluation
(1)
Projets
1
100%
Arbitrage
0
En retard
0
Gratuit
19
Développeur 19
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Commandes similaires
[Automatic Level Detection Group] - Enable Auto Detection: Yes/No - Number of Levels Required: (Number) 3-5 - Lookback Bars: (Number) 100-200 - Minimum Touches for Strong Level: (Number) 2 - Use Zig Zag Algorithm: Yes/No - Use Level Clustering: Yes/No - Max Cluster Distance (points): (Number) [Display and Drawing Group] - Resistance Line Color: (Color) - Support Line Color: (Color) - Show Info Labels: Yes/No - Lines
Società di investimento con attività tra Sanremo e Monaco ricerca un giovane collaboratore con esperienza nell’utilizzo avanzato di MetaTrader 5. Si richiede la conoscenza della lingua ITALIANA e INGLESE. Si richiede una chiamata conoscitiva. Il collaboratore si occuperà di: • eseguire backtest di strategie di trading su MT5 • effettuare ottimizzazioni parametri tramite Strategy Tester • analizzare risultati e
News trader MT4 EA 30 - 70 USD
I want a smart developer to build an expert advisor for MT4 platform to auto read news from popular websites and use pending orders to capture price spike during high impact news releases
Hello, I have an MQ4 file EA that needs to be adjusted regarding entry conditions. ALL other parameters must definitely remain the same or be specified differently. I am attaching it herewith. The stop-loss type in the new EA have to be ALWAYS a Fixed Stop-loss. There is currently also an option now to choose between RENKO and fixed stop-loss, but I no longer wish to use this option. I am also no longer using the
Project Expectations for MT4 Indicator: The indicator will be named "ADR_ATR_Range_Filter." It will include input parameters: ADR Period (e.g., 14 days) ATR Period (e.g., 14 periods) Trigger Range Start Time (user-defined, e.g., “03:00”) Trigger Range End Time (user-defined, e.g., “10:00”) Trigger Range Threshold as % of ADR (Min and Max, e.g., 20%–70%) Trigger Range Threshold as % of ATR (Min and Max, e.g., 20%–70%)
Hi Im working with a Crypto trading company and we want to branch out with our indicator, i'm researching the bot automation and need some hands on board. i i want to hear your opinion about the indicator that i would like you to build. in the PDF i explain the whole indicator and how it need to look like. happy to hear form you
I want someone to hold a session for me and explain in details on how to implement them in. I would really appreciate your guidance on how to properly set up GoCharting and get access to CME futures data
Existing EA 30 USD
I’m looking to acquire an existing, profitable Expert Advisor (EA) with full source code to add to our client investment portfolio. To be clear, this is not a request to develop or design a new strategy. If you already have an EA that is proven, consistent, and production-ready, I’m open to reviewing it immediately. Please apply only if you meet all the requirements below. Submissions without a proper introduction or
EA Script editor 30 - 35 USD
I need someone who will help me with a script that supports / cancels out negative positions. So that with a deposit of 600 euros, it doesn't close 300 euros. More info on pv
As in the title, for the following instruments: Eurostoxx 50 (Euro50), Dow Jones (UsaInd), Nasdaq (UsaTec), Hang Seng (HKInd), Crude Oil (LCrude), Gold (GOLD) I need 10 years (since 2015) history for 1H timeframe Backtesting of my EAs. Thanks a lot in advance. Federico

Informations sur le projet

Budget
200 - 700 USD
Délais
de 10 à 15 jour(s)

Client

Commandes passées1
Nombre d'arbitrages0