Night Flat Trade
This EA trades during the Asian (night) session when the market is typically in a flat/ranging state. It identifies consolidation periods using ATR-based channel detection and enters breakout or mean-reversion trades within the defined night session window. All positions are closed before the high-volatility London session begins.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core concept of this strategy is to capture flat/ranging market conditions during the Asian night session, exploiting the low-volatility environment for range-bound trading. Entry conditions are based on ATR channel detection to determine if the market is in a flat state, with mean-reversion entries when price touches the channel boundaries, or breakout entries following a narrow consolidation period. Exit conditions include fixed take-profit and stop-loss levels, plus a mandatory close of all positions before the London session opens to avoid gap risks. Position sizing uses either fixed lots or a percentage-based calculation tied to account balance, supporting multiple symbols simultaneously. Money management incorporates maximum position limits and daily maximum loss thresholds to prevent excessive losses from unexpected nighttime volatility spikes.
Strengths
- Exploits the low-volatility night session, avoiding high-volatility news and event risks
- Mandatory close before London session effectively mitigates gap and slippage risks
- Daily maximum loss limit prevents catastrophic losses from unexpected market moves
- Clear strategy logic with sound session selection, suitable for fully automated operation
Weaknesses
- Nighttime low liquidity can cause spread widening, increasing trading costs and slippage risk
- Asian session can occasionally experience sudden volatility (e.g., BOJ decisions) and the strategy lacks a news filter
- ATR threshold parameter may not accurately judge market state and requires separate optimization per instrument
- Mean-reversion approach is vulnerable to consecutive stop-losses when a trend suddenly emerges
Possible improvements
- Add a spread filter to prohibit opening positions when the spread exceeds a threshold, avoiding trading in high-cost environments
- Incorporate an economic calendar event filter to avoid trading around major events like central bank decisions
Risk assessment
Overall risk: Medium
- Spread widening during low-liquidity night hours can cause actual fill prices to deviate significantly from expectations
- Lack of news event filtering may lead to unexpected losses during major surprise events
- Fixed ATR threshold parameters may fail under varying market conditions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
StartHour | 21 | Night session start hour (server time) |
EndHour | 7 | Night session end hour (server time) |
ATR_Period | 14 | ATR period for flat market detection |
FlatATRThreshold | 0.001 | ATR threshold below which market is flat |
LotSize | 0.1 | Initial lot size, martingale base quantity |
StopLoss | 200 | Stop loss in points, max loss per trade |
TakeProfit | 100 | Group TP in points, close all at this profit |
MaxPositions | 3 | Maximum simultaneous positions |
MaxDailyLoss | 5 | Maximum daily loss percentage |
MagicNumber | 20815 | EA magic number to distinguish trade instances |
CloseBeforeLondon | true | Force close positions before London session |
Similar Session Trading EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.